Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752720AbdFNRos (ORCPT ); Wed, 14 Jun 2017 13:44:48 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:19430 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751624AbdFNRor (ORCPT ); Wed, 14 Jun 2017 13:44:47 -0400 Subject: Re: [PATCH v4 2/4] xen: add sysfs node for guest type To: Juergen Gross , linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org References: <20170614172352.27557-1-jgross@suse.com> <20170614172352.27557-3-jgross@suse.com> Cc: gregkh@linuxfoundation.org From: Boris Ostrovsky Message-ID: Date: Wed, 14 Jun 2017 13:43:45 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170614172352.27557-3-jgross@suse.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1025 Lines: 46 > --- a/Documentation/ABI/testing/sysfs-hypervisor-pmu > +++ b/Documentation/ABI/testing/sysfs-hypervisor-xen > @@ -1,8 +1,19 @@ > +What: /sys/hypervisor/guest_type > +Date: May 2017 > +KernelVersion: 4.13 > +Contact: xen-devel@lists.xenproject.org > +Description: If running under Xen: > + Type of guest: > + "Xen": standard guest type on arm > + "HVM": fully virtualized guest (x86) > + "PV": paravirtualized guest (x86) > + "PVH": fully virtualized guest without legacy emulation (x86) > + > > > +static ssize_t guest_type_show(struct hyp_sysfs_attr *attr, char *buffer) > +{ > + const char *type = "???"; > + > + switch (xen_domain_type) { > + case XEN_NATIVE: > + /* ARM only. */ > + type = "Xen"; > + break; > + case XEN_PV_DOMAIN: > + type = "PV"; > + break; > + case XEN_HVM_DOMAIN: > + type = xen_pvh_domain() ? "PVH" : "HVM"; > + break; > + } I think we should return -EINVAL for unknown type. Or document "???" in the ABI document. -boris > + return sprintf(buffer, "%s\n", type); > +} >