From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxL0z-0001h8-8P for qemu-devel@nongnu.org; Fri, 13 Nov 2015 15:32:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxL0u-0008P9-61 for qemu-devel@nongnu.org; Fri, 13 Nov 2015 15:32:09 -0500 Received: from e39.co.us.ibm.com ([32.97.110.160]:57904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxL0u-0008Ou-01 for qemu-devel@nongnu.org; Fri, 13 Nov 2015 15:32:04 -0500 Received: from localhost by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 13 Nov 2015 13:32:03 -0700 Date: Fri, 13 Nov 2015 12:29:20 -0800 From: Sukadev Bhattiprolu Message-ID: <20151113202920.GB20970@us.ibm.com> References: <1446678366-15082-1-git-send-email-sukadev@linux.vnet.ibm.com> <20151109045812.GE18558@voom.redhat.com> <20151110042232.GB20030@us.ibm.com> <5641BEB6.3020902@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5641BEB6.3020902@redhat.com> 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: Thomas Huth 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, David Gibson Thomas Huth [thuth@redhat.com] wrote: | 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 = fopen(file_name, "r"); | > | > + if (!fp) { | > | > + error_report("%s: Error opening %s\n", __func__, file_name); | > | > + return -1; | > | > + } | > | > + | > | > + rc = fread(buf, 1, len, fp); | > | > + fclose(fp); | > | > + | > | > + if (rc != len) { | > | > + return -1; | > | > + } | > | > + | > | > + return 0; | > | > +} | | Could you maybe use g_file_get_contents() instead? I guess I could, but since we are moving the new code to target-ppc/kvm.c, I found some existing code in kvmppc_read_int_cpu_dt() that I could reuse. Will post the patch later today, appreciate if you could double check. | | > | > +/* | > | > + * 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 system. | > | | > | True on IBM POWER systems, but not necessarily everywhere - e.g. PR | > | KVM on an embedded PowerPC host. | > | > 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. Ok. Thanks for the detailed info. | 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) Yes, I am now adding a stub for the #ifndef KVM in target-pcc/kvm_ppc.h. I am checking for zeros in chips, modules and cores but the new RTAS parameter will likely return zeroes on other targets for now - until we can figure out how PR KVM or the embedded PPCs can determine this RTAS info. | Thomas |