From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zw5ct-0001WQ-CP for qemu-devel@nongnu.org; Tue, 10 Nov 2015 04:54:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zw5cq-0004NZ-M2 for qemu-devel@nongnu.org; Tue, 10 Nov 2015 04:54:07 -0500 References: <1446678366-15082-1-git-send-email-sukadev@linux.vnet.ibm.com> <20151109045812.GE18558@voom.redhat.com> <20151110042232.GB20030@us.ibm.com> From: Thomas Huth Message-ID: <5641BEB6.3020902@redhat.com> Date: Tue, 10 Nov 2015 10:53:58 +0100 MIME-Version: 1.0 In-Reply-To: <20151110042232.GB20030@us.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 1/1] target-ppc: Implement rtas_get_sysparm(PROCESSOR_MODULE_INFO) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sukadev Bhattiprolu , David Gibson Cc: stewart@linux.vnet.ibm.com, benh@au1.ibm.com, aik@ozlabs.ru, nacc@linux.vnet.ibm.com, agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, paulus@au1.ibm.com On 10/11/15 05:22, Sukadev Bhattiprolu wrote: [...] > | > +static int file_read_buf(char *file_name, char *buf, int len) > | > +{ > | > + int rc; > | > + FILE *fp; > | > + > | > + fp =3D fopen(file_name, "r"); > | > + if (!fp) { > | > + error_report("%s: Error opening %s\n", __func__, file_name= ); > | > + return -1; > | > + } > | > + > | > + rc =3D fread(buf, 1, len, fp); > | > + fclose(fp); > | > + > | > + if (rc !=3D len) { > | > + return -1; > | > + } > | > + > | > + return 0; > | > +} Could you maybe use g_file_get_contents() instead? > | > +/* > | > + * Each core in the system is represented by a directory with the > | > + * prefix 'PowerPC,POWER' in the directory /proc/device-tree/cpus/= . > | > + * Process that directory and count the number of cores in the sys= tem. > |=20 > | True on IBM POWER systems, but not necessarily everywhere - e.g. PR > | KVM on an embedded PowerPC host. >=20 > What is PR KVM? On PPC, there are multiple kinds of KVM kernel modules, e.g. KVM-HV and KVM-PR (and further implementations for embedded PPCs, too). KVM-HV is using the hypervisor hardware feature of the current POWER7 and POWER8 chips, while KVM-PR is using the PRoblem state to emulate a virtual machine. KVM-PR thus also works on older PPC hardware. So there are multiple PPC environments where QEMU can run on, and you must not assume that you always have nodes like "PowerPC,POWER" in the device tree. (BTW, you can also build kernels without the /proc/device-tree file system as far as I know ... so you never should fully rely on that without a fallback strategy) Thomas