[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-4.17 5/6] pci: do not disable memory decoding for devices
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Mon, 24 Oct 2022 14:45:24 +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=CYglnLr7u2WVkJnTDNyIpIYcFDZjiMFM9S28GAh3mTI=; b=AxliQlc85rkJNtQQTfDYVSwB81zzsrzgF/FexS3waWlwho0XhIDXGUMPIt1+yTZuIg+reEYu3oh+7QzWNQIwFbaImcHAx3rkV1GjctvJj4w5McSjrR5wQdprFHazPDFVYwPhcbZpf11oKFx5KTyehhm6AeXTiT63vmWMnnhF4nRpakkevhoGoA9272MbSWqhD2C+KeQv/I/I/2SvvvYVJitkY5KtpZ7ciL6I4ZmchKXwP74UX1pSkup5lGslMLNVBtIfUrj+FKdc45kjHzXx+aBHR7lUR5aitUqC672td1MIq7okeh0ogdR1UwY/4RXIrbMbMuJHNgUv1vByeSZ5vA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NC97ugPIuJvhxIb6aGnp2HloaMCv2yIc39WVOwaZpEwsFocnWjDeXnRzaMdwTwBSbw+G6Yij2HOY8DZQ9CQhlfBpuAsAIeoOdxBhPh0XtJOHTiW05Q4ltMFH7ez2e4/aRo+2jccFd5BVwNgc5s/Bn4QRTvj44V+l3GnnhoTXxMyA1oWID7GyJJfcK228xYBgbTyIyonxqFSsnf9DfATahS/skxBFJ/80DywcG4wkcDvze2BERBTRmGkNZqBRvyVs8xfZVirBaqnFZPJClQImUalKF9iySBo7BqOzaXojv+cq63IrukTXrAYlxS40/bFY01WXOkKxBfj0W2+4pVXHyQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Paul Durrant <paul@xxxxxxx>
- Delivery-date: Mon, 24 Oct 2022 12:45:52 +0000
- Ironport-data: A9a23:smh7AK8oFmMhnYH0pnArDrVtTnXEyJsLBUUsXf1Ep+oz8vayuhV8yJ73PPB8VjkiIqRVR6oqiDZNU05uCsLcQJaoguFu7eu1ONQhlI7w+waK85O8q+NT/4WP7pEhYAjnV2bCfSXkiylgmDPm+2Y7KJM0r73KUi3KZJgNjtvuiXfYxy441lej3EJ15mIn16KO7VXj8+59pjM87V2gwJxGxF0lKAS5kVS794+w+eJc581nPipOJ5oK0+E0VEPUuhv+1ohrqcrXbVu0muLFT8xM3jGowWoT/kXwteLcmL+7zA/kY81UNyYc8lhEV0AYc6rOOWvjehqex6WhlISmmSwnffiXELOEl7ec3OM3pdIdEmVByxJNwnPrSIH6u4bvUYIY12eIrEoZHMCg4MoVfBQYct9W1aGL7geBEqr49F0awPuz8w96n9UlTnyAHHo04Q/q0Q5OyD7I7BrETpXFQWDSOZDzHFz2JLXFMHqIDV89Wuns79D7Ta+ZAVudmEHfslmZ4NfTebDuvprJ79FPy+fjf0TEzWhqdKQ4UcTjZzED2Lq3YHHpIdnvHi/H4K9xFs/rg/DJLzhtjOBkBW3LPqhMMO3KjXrYwXGLz0T2SAuUFN7SteQ/RkLn62py9xS53i2Q2sIeMxvitATNNYVl0linTsYQYV3g1lePMxVtHEGuVFMTn3/ttXa0rcynI/F+dlX5Cuj86kwwe6dokI81BOCtc7ZP8QHJHeju/cWauJ6VIL11tpan9pBb0EsgDNGXgh9/p/kYY/QR11BRvvTO6ICyXSxGBel85Gh2S+wCWuOwpVw5BbEG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/qrDL0oaHnwqj1iXvK8cuphaUF3JaKfXsjXeBDIAiVeE1F8P2sn3+bteNC32yyBn/qawhOzLwF+8KG2xtfZoUvpWlC3phj0oIwVT8JWttsW3h2HkX5QiyXTs9YGvxdMzoOevKD3PaQamKWSQpiQyLRW7xSRmrSWtQsIeANSLJbfW9YBWNvy6FejbkvXzD3wJEiz7u0DI5T0VetSSXkI4Sk1FsF6q/ppMu5oQiIAo8Zhh0kiQhNfuy0DzYcYnIDvqAldGNN52fScKs8KrnbXH8qorxUCIaqpI9qA1HTxocjPpyO5/GzJ9YAMAbZWK8VHDw5wPW5lr2IHoS4iLr6HBCXfpitd1JlgorBBC47d4Y+tRwurYkxijXKheejK3Hz1GzyFAQbTxClCqZkvZ00mEcfEbNZ+6PprReTSQDo78b9qQfAwWYecp0F4nuIGF/64RpbooDYBlOzkLkGuy6l5mUK2DsFZrP3Xl09mcJPkO4oFY
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Mon, Oct 24, 2022 at 01:19:22PM +0200, Jan Beulich wrote:
> On 20.10.2022 11:46, Roger Pau Monne wrote:
> > Commit 75cc460a1b added checks to ensure the position of the BARs from
> > PCI devices don't overlap with regions defined on the memory map.
> > When there's a collision memory decoding is left disabled for the
> > device, assuming that dom0 will reposition the BAR if necessary and
> > enable memory decoding.
> >
> > While this would be the case for devices being used by dom0, devices
> > being used by the firmware itself that have no driver would usually be
> > left with memory decoding disabled by dom0 if that's the state dom0
> > found them in, and thus firmware trying to make use of them will not
> > function correctly.
> >
> > The initial intent of 75cc460a1b was to prevent vPCI from creating
> > MMIO mappings on the dom0 p2m over regions that would otherwise
> > already have mappings established. It's my view now that we likely
> > went too far with 75cc460a1b, and Xen disabling memory decoding of
> > devices (as buggy as they might be) is harmful, and reduces the set of
> > hardware on which Xen works.
> >
> > This commits reverts most of 75cc460a1b, and instead adds checks to
> > vPCI in order to prevent misplaced BARs from being added to the
> > hardware domain p2m.
>
> Which makes me wonder: How do things work then? Dom0 then still can't
> access the BAR address range, can it?
It does allow access on some situations where the previous arrangement
didn't work because it wholesale disabled memory decoding for the
device.
So if it's only one BAR that's misplaced the rest will still get added
to the dom0 p2m and be accessible, because memory decoding won't be
turned off for the device.
> Plus with this adjustment, is
> ...
>
> > Signaling on whether BARs are mapped is tracked
> > in the vpci structure, so that misplaced BARs are not mapped, and thus
> > Xen won't attempt to unmap them when memory decoding is disabled.
> >
> > This restores the behavior of Xen for PV dom0 to the state it was
> > previous to 75cc460a1b, while also introducing a more contained fix
> > for the vPCI BAR mapping issues.
>
> ... this (in particular "restores the behavior") a valid description
> of this change?
Yes, it restores the previous behavior for PV dom0, as memory decoding
is no longer turned off for any devices regardless of where the BARs
are positioned.
> > Fixes: 75cc460a1b ('xen/pci: detect when BARs are not suitably positioned')
> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> > ---
> > AT Citrix we have a system with a device with the following BARs:
> >
> > BAR [0xfe010, 0xfe010] -> in a EfiMemoryMappedIO region
> > BAR [0, 0x1fff] -> not positioned, outside host bridge window
> >
> > And memory decoding enabled by the firmware. With the current code
> > (or any of the previous fix proposals), Xen would still disable memory
> > decoding for the device, and the system will freeze when attempting to
> > set EFI vars.
>
> Isn't the latter (BAR at address 0) yet another problem?
It's a BAR that hasn't been positioned by the firmware AFAICT. Which
is a bug in the firmware but shouldn't prevent Xen from booting.
In the above system address 0 is outside of the PCI host bridge
window, so even if we mapped the BAR and memory decoding for the
device was enabled accessing such BAR wouldn't work.
> I have to admit
> that I'm uncertain in how far it is a good idea to try to make Xen look
> to work on such a system ...
PV dom0 works on a system like the above prior to c/s 75cc460a1b, so I
would consider 75cc460a1b to be a regression for PV dom0 setups.
Thanks, Roger.
|