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

Re: [XEN][PATCH v12 20/20] tools/xl: Add new xl command overlay for device tree overlay support


  • To: Michal Orzel <michal.orzel@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 6 Sep 2023 10:26:40 +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=m9M4gm6WkdVeiHtQFvdsgD3j/V3QgLej0YlSXnMOTKw=; b=Q/JROAbdBMxBEbV8wtMJCN1iq34K1x6490IolyL2Z8t10i6gzvLLlLYCuwxWS2rFldasOnV1JWbAxfu87xLL791/daMOTocuV9u6dGhv7x3hwuxaLbNuEnwGszvZ1OC91BNyljweXSeZVHb2Gah62gVET6heW5Q/Ecy05JEpS1KgWrpqBxtEtNOJhHN7tLL69/CuW9/V4hicaBWRnTAOOc9y6TVkJB7F2VI/djLHB+aGlzBMehYk6s3mhSTWPVaovkvTmz6j3X1Yt6F6gPmWmLpupJ0PxxBkhtfQ6YbWGvrZkvS142tiJwjlS8sBlQ+N6i3nr3+G1TZCUPszd85jig==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hr2WVE1U1Vktbe4nNcimcHksc58GyP9ZHz1rNHcHLiJkdSD8oy/qYfsTS8blUlGtMloWbIq3AiSFbWyGgUQhuiVYXOwZN/zHObHeVl9Fnf8Q5iS7t33qna5nofsIhLwG6xwHXA/4NKlzhb3MaTghOWz9VM5wD5eEzU6VVeeIlsN2S0s6ZJ0aQflhdtCuyUp0ZlMWZV85xqQU24MB9kCE1teeenXZ+zXwAdRLSEKvj3mbvAnRwvygRt77ZXiofPtsAU7xD7Yj/I6+irzfgs5Q2lrYSVO7CZGqUFDedQnIhmx8ebsyqAvAJPDkpl9211poRJCqnKQ48QFNHUBVaRmXLw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: julien@xxxxxxx, sstabellini@xxxxxxxxxx, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Vikram Garhwal <vikram.garhwal@xxxxxxx>
  • Delivery-date: Wed, 06 Sep 2023 08:26:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06.09.2023 10:06, Michal Orzel wrote:
> 
> 
> On 06/09/2023 09:57, Jan Beulich wrote:
>>
>>
>> On 06.09.2023 09:32, Michal Orzel wrote:
>>>
>>>
>>> On 06/09/2023 08:55, Jan Beulich wrote:
>>>>
>>>>
>>>> On 06.09.2023 03:16, Vikram Garhwal wrote:
>>>>> --- a/tools/xl/xl_vmcontrol.c
>>>>> +++ b/tools/xl/xl_vmcontrol.c
>>>>> @@ -1265,6 +1265,58 @@ int main_create(int argc, char **argv)
>>>>>      return 0;
>>>>>  }
>>>>>
>>>>> +int main_dt_overlay(int argc, char **argv)
>>>>> +{
>>>>> +    const char *overlay_ops = NULL;
>>>>> +    const char *overlay_config_file = NULL;
>>>>> +    void *overlay_dtb = NULL;
>>>>> +    int rc;
>>>>> +    uint8_t op;
>>>>> +    int overlay_dtb_size = 0;
>>>>> +    const int overlay_add_op = 1;
>>>>> +    const int overlay_remove_op = 2;
>>>>> +
>>>>> +    if (argc < 2) {
>>>>> +        help("dt_overlay");
>>>>> +        return EXIT_FAILURE;
>>>>> +    }
>>>>> +
>>>>> +    overlay_ops = argv[1];
>>>>> +    overlay_config_file = argv[2];
>>>>> +
>>>>> +    if (strcmp(overlay_ops, "add") == 0)
>>>>> +        op = overlay_add_op;
>>>>> +    else if (strcmp(overlay_ops, "remove") == 0)
>>>>> +        op = overlay_remove_op;
>>>>> +    else {
>>>>> +        fprintf(stderr, "Invalid dt overlay operation\n");
>>>>> +        return EXIT_FAILURE;
>>>>> +    }
>>>>> +
>>>>> +    if (overlay_config_file) {
>>>>> +        rc = libxl_read_file_contents(ctx, overlay_config_file,
>>>>> +                                      &overlay_dtb, &overlay_dtb_size);
>>>>> +
>>>>> +        if (rc) {
>>>>> +            fprintf(stderr, "failed to read the overlay device tree file 
>>>>> %s\n",
>>>>> +                    overlay_config_file);
>>>>> +            free(overlay_dtb);
>>>>> +            return ERROR_FAIL;
>>>>> +        }
>>>>> +    } else {
>>>>> +        fprintf(stderr, "overlay dtbo file not provided\n");
>>>>> +        return ERROR_FAIL;
>>>>> +    }
>>>>> +
>>>>> +    rc = libxl_dt_overlay(ctx, overlay_dtb, overlay_dtb_size, op);
>>>>
>>>> Because of this being Arm-only (as validly pointed out by osstest), I 
>>>> expect
>>>> the entire function here as well as its entry in cmd_table[] want to be
>>>> Arm-specific, too? Of course it would be nice to not key this to __arm__ /
>>>> __aarch64__, but to something that would not need touching again if the
>>>> underlying infrastructure was made available to, say, RISC-V as well. But 
>>>> of
>>>> course - right now the goal needs to be to address the CI and osstest
>>>> breakage.
>>> I agree. I would suggest to guard it with LIBXL_HAVE_DT_OVERLAY which is 
>>> for now
>>> only defined for arm32/arm64. This way the code will not need to be 
>>> modified if other
>>> arch gain support for the feature.
>>
>> Ah yes, that ought to work. While there perhaps also replace the conditional
>> around the declaration of the function in libxl.h. (But of course Anthony
>> may tell me/us that this isn't the way to go.)
> Hmm, if we change guards for libxl_dt_overlay(), what about xc_dt_overlay()
> for which we cannot use LIBXL guard?

I'd key that to some suitable sysctl definition from the public header. If
need be, the sub-op #define itself could be made conditional and then be
used for that purpose.

> Is it ok in that case or better just focus > on the fix.

Personally I'd consider dealing with just the breakage sufficient for the
moment. The libxc part then of course still wants dealing with later on,
preferably in time for 4.18.

Jan



 


Rackspace

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