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

Re: [PATCH] drivers/xen/hypervisor: Expose VM SIF flags to userspace


  • To: Per Bilse <per.bilse@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx
  • From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • Date: Tue, 29 Nov 2022 11:29:56 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.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=mq2EyLheTw9mVWD65B0+V3EYuiw20r72c130RGNlN2Q=; b=eqsnxOm0AcZzAXJPOmF6mJLpJOjlJrn8eleHm6kj7tPr1/EnK8BSgUOeXr+ls9Nzc7+6IWfYIErbic5rzlyjMKymSMFmR6Dc6e+0FXkSmAViZBvtAzUa/MvHklTIivoLI+lSo7j1BGsR0mhBTYU1gvp7hKEy9mU74ZxFIzYkviPljbA9r3Vku5Zby9ZoXUz+TNtLnBwF7JF450QHXn9AVQPhBd4InMrwANngE4ppFlZP7UTORj+Du273htT3CKiEVSNqeViydc9ehzoO4zMuUTMm26WeogKyFFnWw7xyYphrBmKy+DL/cfsNy7jbBUR1DLmWt3lnzkuPzofO4BZl+A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HARGsOKu8jZHnVsmGeA4zYrAP9KBnsvp3XWFUsnzJXacNaQSQJaYE5v9bsxLJoTeVvQnb8qgnWC7Otzcepu+Tj5Du3lTSEb8fZbeoRn+X/qzXcW/gSOVhhyTCbc0Vs+ZFuF57zNdz53Ak+1ug4Bm0ja2Bjw9F+wlPlcdGyoHvE7pkYAFl5BR6yHJKLJzT4i0RChI0zqBC5YEXyE0k+ku9yra8u3IdISbkvQ+RN10y7Y5u1KBVAUTH9yxjEjiDbWTXSF78fPgAFMnmfdx9WkCD92jWbhlHC/7zw1iBDJbXyhbrlrliLpXqRuAeYnY+sCAwR3sY90M2wXtS31DpBGTxw==
  • Cc: Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "moderated list:XEN HYPERVISOR INTERFACE" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 29 Nov 2022 16:30:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 11/29/22 10:00 AM, Per Bilse wrote:
+static ssize_t flags_show(struct hyp_sysfs_attr *attr, char *buffer)
+{
+       static char const *const sifstr[SIFN_NUM_SIFN] = {
+               [SIFN_PRIV]  = "privileged",
+               [SIFN_INIT]  = "initdomain",
+               [SIFN_MULTI] = "multiboot",
+               [SIFN_PFN]   = "mod_start_pfn",
+               [SIFN_VIRT]  = "virtmap"
+       };
+       unsigned sifnum, sifmask;
+       ssize_t ret = 0;
+
+       sifmask = ~(~0U << SIFN_NUM_SIFN);  // ...0000111...
+       if (xen_domain() && (xen_start_flags & sifmask) != 0) {
+               for (sifnum = 0; sifnum != SIFN_NUM_SIFN; sifnum++) {
+                       if ((xen_start_flags & (1<<sifnum)) != 0)
+                               ret += sprintf(buffer+ret, "%s ", 
sifstr[sifnum]);
+               }
+               buffer[ret-1] = '\n';
+       }
+       return ret;
+}


Why not simply show unprocessed xen_start_flags as a hex value?


-boris




 


Rackspace

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