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

Re: [PATCH v4 3/4] vpci: allow BAR map/unmap without affecting memory decoding bit


  • To: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 24 Apr 2026 10:38:05 +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=arcselector10001; 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=dovTWvXMvbx1uRW13q31Roe/4gyTFgE/R8ddkYUhMjM=; b=ny5jqjFz39p2mGp0T++pi9Djw1/arA/nKKQVHyEngn8zcPNC8p5KgTQS7MBJBtUMTmm8wk12Yvi5KBApE2kbez+UN2gVGa3FlfAqEvtZsPBomHq7ZrWNZmfVwEBHVtlOO2Mbm0HuW0N9lxKTRBNibnGq348d0HpWYNYwTAG9Su6AIQUH8wbBJLn3Xn2YItkCY5NdoGd5OwozoIZkvzi752l7reNxnau0FM9GahmiDkzYDDtkUliAnetYkYFuA6XowZJ1xIvKkL8epogsJly3BLfRjQLM06i2/UZnghSTuC3L//HsdWgPA/id9tMw6I62a7Dpieq3K2uV8TV/3snFcA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PvntZJdk9W+BrM5VTEpzqQAnliXyhUCT2W2wmHRU9qgiWUQ/NvCxmmebGSl5VBK5iB10kilVVvOGr9cS967GNqTKsfV8XKlI4zNKhhcub/1g2PT1TOYNKUUF7IP4Ye7xTVk/1w5rV+ezAq57leuYlnRW/G9eJPP1YcrvSsDVaTiBCeF3eHZSkpzPEjNdYf1qee5M+Le66dsq5aG6mcljvPm2XBQsltCpKC+y8ph0pEMRfe4leWof5xCG8jMWYy6UefrLfOqQrCPk0YoDiujbpmtbK7ynNSOWmMXpxPt0ii1gcjtdRgcsouPUXJNfZN6tSjlxGueRD/bL3WibIzqzTQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 24 Apr 2026 08:38:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Apr 06, 2026 at 03:11:57PM -0400, Stewart Hildebrand wrote:
> Introduce 'bool map' and allow invoking modify_bars() without changing
> the memory decoding bit. This will allow hardware domain to reposition
> BARs without affecting the memory decoding bit.
> 
> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
> ---
> This also lays some groundwork to allow domUs to toggle the guest view
> without affecting hardware, a step toward addressing the FIXME in [1].
> 
> [1] 
> https://lore.kernel.org/xen-devel/20250814160358.95543-4-roger.pau@xxxxxxxxxx/

The deferred toggling of the command register bits seems overly
complex IMO.  It would be much simpler if domUs simply don't get to
play with the real decoding bits.  For the hardware domain we could
toggle the decoding bits ahead of the mapping operations, so that we
don't have to defer the toggling after mappings have been sorted.

Long term we should aim to remove the cmd field from vpci_map_task
struct.

I don't mind if you want to pick the patch in [1] in your series, as
we could then drop the cmd field and possibly simplify some of the
logic in this patch by no longer requiring the deferred write to the
command register?

> v3->v4:
> * rebase on dynamically allocated map queue
> 
> v2->v3:
> * use bool
> * switch to task->map in more places
> 
> v1->v2:
> * new patch
> ---
>  xen/drivers/vpci/header.c | 43 +++++++++++++++++++++------------------
>  xen/include/xen/vpci.h    |  1 +
>  2 files changed, 24 insertions(+), 20 deletions(-)
> 
> diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
> index 146915e28c50..20fe380552f4 100644
> --- a/xen/drivers/vpci/header.c
> +++ b/xen/drivers/vpci/header.c
> @@ -117,11 +117,12 @@ static int cf_check map_range(
>   * BAR's enable bit has changed with the memory decoding bit already enabled.
>   * If rom_only is not set then it's the memory decoding bit that changed.
>   */
> -static void modify_decoding(const struct pci_dev *pdev, uint16_t cmd,
> -                            bool rom_only)
> +static void modify_decoding(const struct pci_dev *pdev,
> +                            struct vpci_map_task *task)

task wants to be const here, unless further patches require modifying
task inside of modify_decoding().

Thanks, Roger.



 


Rackspace

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