xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <Julien.Grall@arm.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: "jgross@suse.com" <jgross@suse.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	nd <nd@arm.com>,
	"Volodymyr_Babchuk@epam.com" <Volodymyr_Babchuk@epam.com>,
	Stefano Stabellini <stefano.stabellini@xilinx.com>
Subject: Re: [Xen-devel] [PATCH v2 1/3] xen/arm: fix buf size in make_cpus_node
Date: Tue, 8 Oct 2019 21:47:27 +0000	[thread overview]
Message-ID: <cdf96832-6a51-d44c-fd00-eba411f414c2@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1910081413160.13684@sstabellini-ThinkPad-T480s>

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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-10-08 21:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08  1:14 [Xen-devel] [PATCH for-4.13 v2 0/3] fixes for make_[memory/cpu]_node Stefano Stabellini
2019-10-08  1:14 ` [Xen-devel] [PATCH v2 1/3] xen/arm: fix buf size in make_cpus_node Stefano Stabellini
2019-10-08 11:15   ` Julien Grall
2019-10-08 21:18     ` Stefano Stabellini
2019-10-08 21:47       ` Julien Grall [this message]
2019-10-08  1:15 ` [Xen-devel] [PATCH v2 2/3] xen/arm: make_memory_node return error on nr_banks == 0 Stefano Stabellini
2019-10-08 12:53   ` Julien Grall
2019-10-08  1:15 ` [Xen-devel] [PATCH v2 3/3] xen/arm: fix duplicate memory node in DT Stefano Stabellini
2019-10-08 12:54   ` Julien Grall
2019-10-08  4:21 ` [Xen-devel] [PATCH for-4.13 v2 0/3] fixes for make_[memory/cpu]_node Jürgen Groß

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cdf96832-6a51-d44c-fd00-eba411f414c2@arm.com \
    --to=julien.grall@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=jgross@suse.com \
    --cc=nd@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=stefano.stabellini@xilinx.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).