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

Re: [PATCH 8/9] vpci/header: Reset the command register when adding devices


  • To: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 6 Sep 2021 16:55:29 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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; bh=Bv9XkP8auOWVn7yNSqj8qEom+vUYrV73C8AOIGJpxcM=; b=TP36ndniocItnaNg5dEvChGUUqU5cgTfXS9RWxHLBmREp76Gh+lMZBHYeD0ZrDUjqYzRopFVEum8cmS7rEhuCT3S1Qf5Zeqf0o8Gi2QzEm86EWs2rbCWotYRLvULIzonL4V/4xnMnlZ45fgRzVVJwcduhlaluvJFq9L6idEJymPOqBlo3G4nPzZ2DzMNIdxM4j68mXPW6EyElD7LFQlwJa53mUBu8bzcqvfFszmvonG3+PcQMsXxQXQU8t17au52RrMGocVEBCnq4qqxe8u/UqjyPUaT8qj3BMs2YYKexxK914/ImHe50WW/lgBMJ2NJunOW3ktFKysMQWMW+kRqjA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kOZU9rIc9MSfr+JyiiMZZdYx9pxdnDaE8vCTVMIoxWw5O662f5akmDI+1+obqGcpPFzHGjMol5prvdlfivynaB4a9bZxbFNYQI8IKk+R/UsFDCVzD+BxBc87JdLFnu9+G9/vGlAraaNbWq+0lsPfKgntM4GEkNNTtMW1hdZP35I7R27MZE9urYxUnH3m6P78R0LzMXSglO2vlHy0eEUe71ks7XbAAxr5nxni7nGS1h/5dCXd26UQ/xd5jARRw2TzBCAZ2iS0/l+CbrouIzyHP6BalilaCMwQ9m9WwhUDmNG76/VWlC3uxQFhuGuHfTlIey7rzZl3paE5VpTXmUty6g==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: julien@xxxxxxx, sstabellini@xxxxxxxxxx, oleksandr_tyshchenko@xxxxxxxx, volodymyr_babchuk@xxxxxxxx, Artem_Mygaiev@xxxxxxxx, roger.pau@xxxxxxxxxx, bertrand.marquis@xxxxxxx, rahul.singh@xxxxxxx, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 06 Sep 2021 14:55:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03.09.2021 12:08, Oleksandr Andrushchenko wrote:
> --- a/xen/drivers/vpci/header.c
> +++ b/xen/drivers/vpci/header.c
> @@ -811,6 +811,16 @@ int vpci_bar_add_handlers(const struct domain *d, struct 
> pci_dev *pdev)
>          gprintk(XENLOG_ERR,
>              "%pp: failed to add BAR handlers for dom%d\n", &pdev->sbdf,
>              d->domain_id);
> +
> +    /*
> +     * Reset the command register: it is possible that when passing
> +     * through a PCI device its memory decoding bits in the command
> +     * register are already set. Thus, a guest OS may not write to the
> +     * command register to update memory decoding, so guest mappings
> +     * (guest's view of the BARs) are left not updated.
> +     */
> +    pci_conf_write16(pdev->sbdf, PCI_COMMAND, 0);

Can you really blindly write 0 here? What about bits that have to be
under host control, e.g. INTX_DISABLE? I can see that you may want to
hand off with I/O and memory decoding off and bus mastering disabled,
but for every other bit (including reserved ones) I'd expect separate
justification (in the commit message).

Jan




 


Rackspace

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