[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 5/9] vpci/header: Implement guest BAR register handlers
- To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Wed, 8 Sep 2021 17:29:52 +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=DvYrDPdby1PLKL0r55nnyfge/U0QTcsM7hcPE5QmApE=; b=THUAS6Z9hmP17VlQgFafqczekRVQN74FatCWz25Qd8Bc/AYVUV/nWu4kD/DuEdPzPzA9PMD/elESRTK6LiMS8Q300wRAQyVF7usJs5RXI+RJjv/lT4QqH59X8wBycXsTzCkb2r/zvYeHnZ0XIxhm2P3bsKUGiJfQSgh0KKsMxRnRk6Sqf+hoWPBy6kFGvsS9d84K0SaA01R4f58ARstfeuxqCNB0FeqXXhaZiM2LIy2bS2XPLs+sy6El3lwpGNvO5XhlNv3XbQCSh6hHi3xfjME8+IhtMdoSvzBp1qAjhoyRI8fjl6qEgdvH6JEuKwAgeI5Se78RtbzFUXbvrWOc7w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XClmFNKyrvyT7I0uCs5oeem2vZ3fCar7EDkD2LPoe6J1cRmBPFOsJL9EKvy4QNx/ofdE3SUQTluDbyPtX+pATJ1kMvAHyS2vFkqZ2e35hnAG9cbe3v1fespU9IoVER++qP94330ucDRhJeodL2PA42o2OLjc5AWWBJYnt+YVVKYI7X1YD3e/iQN+Iw/DoymCxi3O8lsuQkFG6yJ8TMHXHMX3nMWq/pRivaE2IQNYfGEmY4sTnzKS6Vdjz2psHYqwcnsK8gYHNU4dRsL/EVoQVNMbtvFcGdk1D8E0GZNEEC1zJOF+Dxsi5DwuprqduXnInbK6e/kVBlzJQwU0/Ma3kQ==
- 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" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Wed, 08 Sep 2021 15:30:10 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 08.09.2021 17:14, Oleksandr Andrushchenko wrote:
> On 08.09.21 17:46, Jan Beulich wrote:
>> On 08.09.2021 15:33, Oleksandr Andrushchenko wrote:
>>> static void guest_bar_write(const struct pci_dev *pdev, unsigned int reg,
>>> uint32_t val, void *data)
>>> {
>>> struct vpci_bar *bar = data;
>>> bool hi = false;
>>>
>>> if ( bar->type == VPCI_BAR_MEM64_HI )
>>> {
>>> ASSERT(reg > PCI_BASE_ADDRESS_0);
>>> bar--;
>>> hi = true;
>>> }
>>> else
>>> {
>>> val &= PCI_BASE_ADDRESS_MEM_MASK;
>>> val |= bar->type == VPCI_BAR_MEM32 ? PCI_BASE_ADDRESS_MEM_TYPE_32
>>> : PCI_BASE_ADDRESS_MEM_TYPE_64;
>>> val |= bar->prefetchable ? PCI_BASE_ADDRESS_MEM_PREFETCH : 0;
>>> }
>>>
>>> bar->guest_addr &= ~(0xffffffffull << (hi ? 32 : 0));
>
> Do you think this needs to be 0xfffffffful, not 0xffffffffull?
>
> e.g. s/ull/ul
If guest_addr is uint64_t then ull would seem more correct to me,
especially when considering (hypothetical?) 32-bit architectures
potentially wanting to use this code.
Jan
|