From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH] x86/PCI: pass correct register value to XSM Date: Fri, 22 Jun 2012 09:53:51 +0100 Message-ID: References: <4FE44A0A020000780008B4AC@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4FE44A0A020000780008B4AC@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , Daniel De Graaf Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 22/06/2012 09:33, "Jan Beulich" wrote: > When attempting to use AMD's extension to access the extended PCI config > space, only the low byte of the register number was being passed to XSM. > Include the correct value of the register if this feature is enabled; > otherwise, bits 24-30 of port cf8 are reserved, so disallow the invalid > access. > > Signed-off-by: Daniel De Graaf > > Don't fail the permission check except when the MSR can't be read. > > Signed-off-by: Jan Beulich Acked-by: Keir Fraser > --- a/xen/arch/x86/traps.c > +++ b/xen/arch/x86/traps.c > @@ -1701,6 +1701,18 @@ static int pci_cfg_ok(struct domain *d, > return 0; > } > start = d->arch.pci_cf8 & 0xFF; > + /* AMD extended configuration space access? */ > + if ( (d->arch.pci_cf8 & 0x0F000000) && > + boot_cpu_data.x86_vendor == X86_VENDOR_AMD && > + boot_cpu_data.x86 >= 0x10 && boot_cpu_data.x86 <= 0x17 ) > + { > + uint64_t msr_val; > + > + if ( rdmsr_safe(MSR_AMD64_NB_CFG, msr_val) ) > + return 0; > + if ( msr_val & (1ULL << AMD64_NB_CFG_CF8_EXT_ENABLE_BIT) ) > + start |= (d->arch.pci_cf8 >> 16) & 0xF00; > + } > end = start + size - 1; > if (xsm_pci_config_permission(d, machine_bdf, start, end, write)) > return 0; > > >