[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>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 15 Oct 2021 12:14:51 +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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UGochgLon9VsdOmajJGgaWQk2WlIGXRMlKdcLCdPRYE=; b=Lr47QeOLC3D1UJ6ef6G9kUI/wMI6nrnae7iMOLStEwIqSvKvaRHBPRVil02gGSbm0QLWZff7OOZhPjTj7JPEBCxUtsPpPVl8syR/A+WEINLeheoEfodaW3gcrr3X5eFLSBnFtUPPbFXZChnS2rtK2Is7Y0nJ5hJOVMpkR/i3Y3cpLE9KRfKzWnfucpjQN+706EDVgB02sJ1hlk0KjUQ5wvVu2+q0JSSgdTT8i+CS9VyXzmwztxrgt3LolrmTuVnV1VgDb5Hx6Ki1Q300yzak/j4fiSIcsXI65XE/Aj2xkMmuVWucki8UfpYMP34sZevL8l7K5hWzhoVZ5H+T3J9u9Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hQcOgqxS7i430luD8UG1gSw3XvW+ke8Lq21MxFEcqsqyU+IDODkvKYAhx4EtxoCvAdkkhdJhghtvWbkUlC7AvV3U/Gt80CBm4Oad3k3R3IaTMh+OFFqmxUyHZjRTq9IgNaulOh4lRUMmSCUTGnA+5OSXkeLCAUa3zcn0xSFawulieEiDdBt80qwq1sPbyJg4ePHA0W+hK6Zr0UhNbPmQWawEQYDG2CH/fA5LYyL+CRPbrrqWfYXoIdnV4Asgpa7bjOTANWzkfuVeWB7zFAnj+csIKHZI4ACl8XI9WHvNz0E3pwB4S5uJg1iV9Im60FNM6NfhrfXZDcWunxbdfNsvIA==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "iwj@xxxxxxxxxxxxxx" <iwj@xxxxxxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 15 Oct 2021 10:15:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.10.2021 11:53, Roger Pau Monné 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?
> 
> 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.

I have to admit I can't even think of how such a plan could look like,
give x86'es history.

Jan




 


Rackspace

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