From: "Jan Beulich" Subject: Re: [PATCH v2] x86: synchronize PCI config space access decoding Date: Wed, 17 Jun 2015 07:29:01 +0100 Message-ID: <55812FCD0200007800085D4C@mail.emea.novell.com> References: <557EFDC30200007800084F27@mail.emea.novell.com> <557EEFFF.7080807@citrix.com> <557FF5BE020000780008547C@mail.emea.novell.com> <55806A59.3080201@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z56qN-0003jy-AG for xen-devel@lists.xenproject.org; Wed, 17 Jun 2015 06:29:03 +0000 In-Reply-To: <55806A59.3080201@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org >>> On 16.06.15 at 20:26, wrote: > On 16/06/15 09:09, Jan Beulich wrote: >>>>> On 15.06.15 at 17:32, wrote: >>> On 15/06/15 15:30, Jan Beulich wrote: >>>> @@ -2439,9 +2434,19 @@ struct hvm_ioreq_server *hvm_select_iore >>>> >>>> type = IOREQ_TYPE_PCI_CONFIG; >>>> addr = ((uint64_t)sbdf << 32) | >>>> - CF8_ADDR_HI(cf8) | >>>> CF8_ADDR_LO(cf8) | >>>> (p->addr & 3); >>>> + /* AMD extended configuration space access? */ >>>> + if ( CF8_ADDR_HI(cf8) && >>>> + d->arch.x86_vendor == X86_VENDOR_AMD && >>>> + d->arch.x86 >= 0x10 && d->arch.x86 <= 0x17 ) >>>> + { >>>> + uint64_t msr_val; >>>> + >>>> + if ( !rdmsr_safe(MSR_AMD64_NB_CFG, msr_val) && >>> We now have several common paths which read this MSR looking for CF8_EXT. >>> >>> I think it would make sense to probe this on boot and have a >>> cpu_has_amd_cf8_ext rather than repeatedly sampling an off-cpu MSR, >>> although this would require synchronising it across all northbridges in >>> emulate privileged op. >>> >>> Alternatively, it might just be better to unconditionally enable it >>> during startup (as Linux does) and prevent dom0 from playing, which >>> would avoid the need to synchronise updates to it. >> You just repeat what you said for v1, without taking into >> consideration my reply thereto: Us not using this method >> ourselves, we should honor and play by what Dom0 does. > > Sorry - I had completely forgotten that this was a v2, and had already > asked this question. > > However, hvm_select_ioreq_server() it not a rare function to call, and I > am still concerned with the overhead. And I can only repeat that the MSR isn't being accessed unless an apparent extended access is being seen. > It turns out that MSR_AMD64_NB_CFG is unconditionally RAZ and has all > writes discarded, so no HVM guest will ever be in a position to > legitimately use AMD extended configuration access. Where have you found that? The register (named NB_CFG1 in newer families' BKGDs) is clearly r/w. Jan