[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/arm: fix SBDF calculation for vPCI MMIO handlers


  • To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 27 Oct 2021 11:23:46 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5L8CzlgT1le84DZ9Sp6SZvczRzklAW2BzcApxY0BHK8=; b=dcfFfk/BIvACbYm8YVPOKHameI0frTqGOvSpu7je83fLLFcVoNohDM7VKznAhVo5hzJLOC3UtiCQuKXoK/tfRK5jx5xgwoNpvgcujnW5Sico5DOsdnUlcHRmg82btGUcoYlX07IibGJraJ25wbhOm9y2iwWyiAJsUSl4cyafSBg8C6Y6JJgiL90xsB6TBENn9uzHIe7yncOsrfT3VVv6Z5gMB2SuPzKWSC/sq20O5aCbFM0Vc5j3f/4LZR531FtO3En/UjZqx5U2qyrQQyrDfnkWakos+CrHHRTykQMCIoT5wafE8Zyl+82P9sFHy+fRYzq/Bs5xm1CJAOmNPLv54g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R6vGwwO1+8I0kAfL23Zd9RvAZAs6Qm+gajciVmOw64LU1ZQZ4kw1NeXYr4rjhhBpitiqt/t0oQ7whPbgt7yl8HBlZ3auXu8aOTofqy0Nv5MNzEwKrk5Ei10NoyaYp2EH4GSn3UODLAy95WMCqiH6KBL/B+YVXDYQOlXnwjDU6O8kXtvm5ANj4s85S5wiCES+D4eybBXcfHSq7ku2WKziSaEfvbyoenPjiy+UP+b04sJZmpkqRLo9uTM86bWJyJUvHRZS5bXAqkPu6Qm7oRQTPqaNPk+xwfjTsu9SCmkKbylaXMtweZPVB2P9UEnFIhFT2jFePIphzoLigY/VS38z1w==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "iwj@xxxxxxxxxxxxxx" <iwj@xxxxxxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>
  • Delivery-date: Wed, 27 Oct 2021 09:24:14 +0000
  • Ironport-data: A9a23:FtxOZ6DvbnZY5BVW/2Hlw5YqxClBgxIJ4kV8jS/XYbTApD4lgmdUz mEWC2+PP/uDZDPweY12Ody/9EsO7cOAn4RmQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMo/u1Si6FatANl1ElvU2zbue6WLGs1hxZH1c+EX550007wobVv6Yz6TSHK1LV0 T/Ni5W31G+Ng1aY5UpNtspvADs21BjDkGtwUm4WPJinj3eH/5UhN7oNJLnZEpfNatI88thW5 Qr05OrREmvxp3/BAz4++1rxWhVirrX6ZWBihpfKMkQLb9crSiEai84G2PQghUh/0xeiu9J88 eR0lKOVdVsIHYHSpNkeekwNe81+FfUuFL7vJHG+tYqYzlHccmuqyPJrZK00FdRGoKAtWzgIr KFGbmBWBvyAr7veLLaTUO5ji95lNMD2FIgepmth3XfSCvNOrZXrHvuVvoUCgWlYasZmOPD9X 8ErciBWNUrQSUcfNHkJD84UtbL97pX4W2IB8w/EzUYt2EDS0w5ZwLXrKMDSeNGBWYNShEnwj mjL5XjjCxcWctmW0yOY82mEj/XK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qHlxfW3dOWEx
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Oct 27, 2021 at 09:04:39AM +0000, Oleksandr Andrushchenko wrote:
> Hi, Roger!
> 
> On 27.10.21 11:59, Roger Pau Monné wrote:
> > On Wed, Oct 27, 2021 at 11:25:33AM +0300, Oleksandr Andrushchenko wrote:
> >> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> >>
> >> While in vPCI MMIO trap handlers for the guest PCI host bridge it is not
> >> enough for SBDF translation to simply call VPCI_ECAM_BDF(info->gpa) as
> >> the base address may not be aligned in the way that the translation
> >> always work.
> > I think I've already raised this during review [0]. But this is only a
> > problem if you change the current value of GUEST_VPCI_ECAM_BASE
> > AFAICT, as the current value has bits [0,27] clear.
> Exactly, so we were just lucky not to hit this before
> >
> > I assume this is a problem for the hardware domain that needs to trap
> > random base addresses as present on hardware, but that code hasn't
> > been committed yet.
> Yes, I am facing this on the real HW when Dom0's access is trapped
> and the base is not taken into account. So, I have a patch for the
> future upstream which subtracts the relevant base from the gpa,
> e.g. either GUEST_VPCI_ECAM_BASE or bridge->cfg->phys_addr
> >
> > If that's indeed the case, please expand the commit message to contain
> > this information.
> I can only mention about "the current value of GUEST_VPCI_ECAM_BASE
> AFAICT, as the current value has bits [0,27] clear" as of now because
> Dom0 traps are not yet there.

Indeed, I would rather mention both cases, ie:

"This change is not strictly required given the current value of
GUEST_VPCI_ECAM_BASE which has bits 0 to 27 clear, but could cause
issues if such value is changed, or when handlers for dom0 ECAM
regions are added as those will be mapped over existing hardware
regions that could use non-aligned base addresses."

Regards, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.