[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH v2 1/3] xen/arm: fix buf size in make_cpus_node
- To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
- From: Julien Grall <Julien.Grall@xxxxxxx>
- Date: Tue, 8 Oct 2019 21:47:27 +0000
- Accept-language: 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-SenderADCheck; bh=KprLqd0S/lLFtjIA8SgNilU/FPdmxQo0J7dus25eneI=; b=ApvMlDx2xH8qEeQPOra3Sd0F5p0v/AgkJXlMo1mj/109TfpxKFt53kq0MqCI4burDT4DKdsyHCQq32SgiZxoWkN1POHpYHRmSb0mefuBE0tlQdFslhMDzW6YG9Y8Ml0bDCO4/hYqPYp0dwn7RB3KQg4kbFT67Ey4fXeu9FA1AFjBuiiZAx3wC9+U1FrzCY98ymmP7VF4NGpmuZjhafMbHXui/orBFCerzJCRDmNy+qGM6f8AnBxet3ehHuOtq30K4rtDD1hteCWs7qjp4aYwsbG48MRVQMnvmpTrF0gukUl/4XmBXrjzlrIFMZhOLh42JDcik4lBo5TPbX2Wfd2EyA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fSs4gy4zxQsmVlpiAaW5NzudcN/c62N0/92tY8FHmWvCdeEEfPOyyry66Vg3XMV8pFoGknBD8SmjPON76cVfUAXTNcDAbBKknQRYgYzOfLCk6m5RDpWI678tygtrg2HkdJPJzXZCnbpJ9cWCbrrM97d+AKeArgqox6HDZx7aU+wKpBgekUKf2c1dhIBORO8BqfH4aks3jeurrevW4zQ5sGsLorLXQ+I0oSbVAR1jxs5gGqf9JJe3jyCMK8rQnBLVh1/LrwhQ0jPSKmM2edFkq2vhTMjzCBLBRA7NuS+RZ0BmF4WMv6tCTUwXkmY4XbXcRauYpyOcW3UJDdDs7yV6OQ==
- Authentication-results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=none action=none header.from=arm.com;
- Authentication-results-original: spf=none (sender IP is ) smtp.mailfrom=Julien.Grall@xxxxxxx;
- Cc: "jgross@xxxxxxxx" <jgross@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, nd <nd@xxxxxxx>, "Volodymyr_Babchuk@xxxxxxxx" <Volodymyr_Babchuk@xxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
- Delivery-date: Tue, 08 Oct 2019 21:47:55 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: True
- Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Julien.Grall@xxxxxxx;
- Thread-index: AQHVfXXRNk9E99Hf7kidrU8cl9fL76dQqSwAgACXyYCAAAgQgA==
- Thread-topic: [PATCH v2 1/3] xen/arm: fix buf size in make_cpus_node
Hi Stefano,
On 08/10/2019 22:18, Stefano Stabellini wrote:
> On Tue, 8 Oct 2019, Julien Grall wrote:
>> On 10/8/19 2:14 AM, Stefano Stabellini wrote:
>>> The size of buf is calculated wrongly: the number is 64bit, not 32bit.
>>
>> While the variable mpdir_aff is 64-bit, we only write the first 32-bit in the
>> property reg (#address-cells == 1 and fdt_property_cell()). So what needs to
>> be modified is the format here.
>>
>> Also, looking the CPU bindings (see
>> linux/Documentation/devicetree/bindings/arm/cpus.yaml), technically only the
>> bits [23:0] of the mpidr should be used. The rest is zeroed.
>>
>> This is ok because vcpuid_to_vaffinity() is always returning a value
>> following
>> the requirements above. However, for correctness, this may want to be fixed.
>
> It looks like it would be best to change mpdir_aff to uint32_t and
> change vcpuid_to_vaffinity to return a uint32_t.
vcpuid_to_vaffinity is meant to return the AFFx bits of the MIDR (so
32-bit on Arm32 and 64-bit on Arm64). We are only using AFF0 and AFF1,
so the rest is zeroed. But this does not mean we should switch to 32-bit.
If we want to change the interface then, it should be register_t and not
32-bit.
However, I didn't suggest to switch to 32-bit but to transfer the bits
[23:0] to a variable and possibly check that the rest is 0.
Maybe something like:
uint32_t reg;
reg = mpidr_aff & GENMASK(23, 0);
/* We only are able to deal with AFF{0, 1, 2} stored in bits [23:0] at
the moment */
if ( reg != mpidr_aff )
{
printk(XENLOG_ERR "Unable to handle MPIDR AFFINITY 0x%"PRIx64"\n",
mpidr_aff);
return -EINVAL;
}
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|