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

Re: [PATCH v6 1/3] xen/vpci: Move ecam access functions to common code


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 15 Oct 2021 10:12:33 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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=gHihjhMyBnsJlRDO5BLNNL2M+R+5vHhW9efdHWLCojk=; b=KN9jxrAWrFhRPjv4Bgqsru2nO3gfL872He0HQdU0VbHI8vN5tTIMkAF487MeD0LOlNNiZwX7ILmOL/5jEwiuehdYxkC34varuhHT2yZztkXIvZQnWf4FrS+xHTCbXQDYVDxKa6fvwnVn/8vQpOra1tQfShbEpEf7r/KGhR3dHZoCwka8u5v/4z5Jt1c//CdQjEXc67xy4HJl4uBUAS5FjV/Ly/UkWvhT+6qzcXDynCOFXj3w3xZes3xWLbumM8GOpbrURMYOo3/qgDkjb+AOtb4GyVpxnFtHb0t3VDY4+zsBYb8zTcwdOzswzsydlHWNih3ZHor3S4OEUkZxNrsGBg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ktIYFkUVsoASGlGfh0RzgcL+lSeGu77ddKtpn/EOaxUS6REpmAbYApchqL1r3kJwIC+tTX7lmKiKC7w58X4AouRwuuRStkVktQgsuz/qbZT2DTa0ll7EzA+wGR8aQH6tL32Ep9oHjTa7+ET30zxKpq2z/cRQSgNZEPHb/1HvN7RCfCO+uooj5PBh08DJJsp/RbubrZq1/5FjIIfKXga9wvtgLoGwllcvsmXeDtnjRJCf5JmnJO4SnGXWrV/73az96kfJuohbh8GVTAHQIGIz/azUxdlHPNiONEhhLFmC0I1q7kj/wO2qcHbDg/my31dUyV9KY0gapbxdXY1Vg2EVuA==
  • Authentication-results-original: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "iwj@xxxxxxxxxxxxxx" <iwj@xxxxxxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 15 Oct 2021 10:12:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXwQraA42SZeh0QUGI/xX7keuWA6vTrtGAgAACnoCAACGIAIAABUmA
  • Thread-topic: [PATCH v6 1/3] xen/vpci: Move ecam access functions to common code

Hi Roger,

> On 15 Oct 2021, at 10:53, Roger Pau Monné <roger.pau@xxxxxxxxxx> wrote:
> 
> On Fri, Oct 15, 2021 at 07:53:38AM +0000, Bertrand Marquis wrote:
>>> On 15 Oct 2021, at 08:44, Roger Pau Monné <roger.pau@xxxxxxxxxx> wrote:
>>> On Thu, Oct 14, 2021 at 03:49:49PM +0100, Bertrand Marquis wrote:
>>>> @@ -434,25 +420,8 @@ static int vpci_mmcfg_read(struct vcpu *v, unsigned 
>>>> long addr,
>>>>    reg = vpci_mmcfg_decode_addr(mmcfg, addr, &sbdf);
>>>>    read_unlock(&d->arch.hvm.mmcfg_lock);
>>>> 
>>>> -    if ( !vpci_access_allowed(reg, len) ||
>>>> -         (reg + len) > PCI_CFG_SPACE_EXP_SIZE )
>>>> -        return X86EMUL_OKAY;
>>>> -
>>>> -    /*
>>>> -     * According to the PCIe 3.1A specification:
>>>> -     *  - Configuration Reads and Writes must usually be DWORD or smaller
>>>> -     *    in size.
>>>> -     *  - Because Root Complex implementations are not required to support
>>>> -     *    accesses to a RCRB that cross DW boundaries [...] software
>>>> -     *    should take care not to cause the generation of such accesses
>>>> -     *    when accessing a RCRB unless the Root Complex will support the
>>>> -     *    access.
>>>> -     *  Xen however supports 8byte accesses by splitting them into two
>>>> -     *  4byte accesses.
>>>> -     */
>>>> -    *data = vpci_read(sbdf, reg, min(4u, len));
>>>> -    if ( len == 8 )
>>>> -        *data |= (uint64_t)vpci_read(sbdf, reg + 4, 4) << 32;
>>>> +    /* Ignore return code */
>>>> +    vpci_ecam_mmio_read(sbdf, reg, len, data);
>>> 
>>> I think it would be better for vpci_ecam_mmio_read to just return the
>>> read value, or ~0 in case of error, at least that interface would be
>>> simpler and suitable for x86.
>> 
>> I am not quite sure on this as on absolute to read ~0 is possible so the
>> caller cannot distinguish between properly reading ~0 or an access allowed 
>> error.
> 
> How do you report an access allowed error on Arm for the PCI config
> space?

This does not go that far. In the current case this is actually an unaligned
access to mmio which will trigger and exception before reaching the PCI config 
space.

> 
> At least on x86 I don't think we currently have a way to propagate
> such errors, neither a plan to do so that I'm aware.

The behaviour on x86 will not change as we will ignore this.

Regards
Bertrand

> 
> Thanks, Roger.


 


Rackspace

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