qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/1] target-ppc: Implement rtas_get_sysparm(P


From: Sukadev Bhattiprolu
Subject: Re: [Qemu-devel] [PATCH v2 1/1] target-ppc: Implement rtas_get_sysparm(PROCESSOR_MODULE_INFO)
Date: Fri, 13 Nov 2015 12:29:20 -0800
User-agent: Mutt/1.5.21 (2010-09-15)

Thomas Huth address@hidden 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
| 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]