All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	Alexander Graf <agraf@suse.de>, Ram Pai <linuxram@us.ibm.com>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>
Subject: Re: [Qemu-devel] [PATCH] spapr: Add ibm, processor-storage-keys property to CPU DT node
Date: Wed, 23 Aug 2017 20:14:32 -0300	[thread overview]
Message-ID: <87y3q9q3l3.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170822020258.GX12356@umbus.fritz.box>


Hello David,

Thank you for your input.

David Gibson <david@gibson.dropbear.id.au> writes:

> On Mon, Aug 21, 2017 at 05:00:36PM -0300, Thiago Jung Bauermann wrote:
>> LoPAPR says:
>> 
>>     “ibm,processor-storage-keys”
>> 
>>     property name indicating the number of virtual storage keys supported
>>     by the processor described by this node.
>> 
>>     prop-encoded-array: Consists of two cells encoded as with encode-int.
>>     The first cell represents the number of virtual storage keys supported
>>     for data accesses while the second cell represents the number of
>>     virtual storage keys supported for instruction accesses. The cell value
>>     of zero indicates that no storage keys are supported for the access
>>     type.
>> 
>> pHyp provides the property above but there's a bug in P8 firmware where the
>> second cell is zero even though POWER8 supports instruction access keys.
>> This bug will be fixed for P9.
>> 
>> Tested with KVM on POWER8 Firenze machine and with TCG on x86_64 machine.
>> 
>> Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
>
> Regardless of anything else, this clearly won't go in until 2.11 opens.

Ok, not a problem.

>> --- a/hw/ppc/spapr.c
>> +++ b/hw/ppc/spapr.c
>> @@ -605,6 +605,80 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,
>>                            pcc->radix_page_info->count *
>>                            sizeof(radix_AP_encodings[0]))));
>>      }
>> +
>> +    if (spapr->storage_keys) {
>> +        uint32_t val[2];
>> +
>> +        val[0] = cpu_to_be32(spapr->storage_keys);
>> +        val[1] = spapr->insn_keys ? val[0] : 0;
>> +
>> +        _FDT(fdt_setprop(fdt, offset, "ibm,processor-storage-keys",
>> +                         val, sizeof(val)));
>> +    }
>> +}
>> +
>> +#define SYSFS_PROT_KEYS_PATH "/sys/kernel/mm/protection_keys/"
>> +#define SYSFS_USABLE_STORAGE_KEYS SYSFS_PROT_KEYS_PATH "usable_keys"
>> +#define SYSFS_DISABLE_EXEC_KEYS SYSFS_PROT_KEYS_PATH "disable_execute_supported"
>> +
>> +static void setup_storage_keys(CPUPPCState *env, sPAPRMachineState *spapr)
>> +{
>> +    if (!(env->mmu_model & POWERPC_MMU_AMR))
>> +        return;
>> +
>> +    if (kvm_enabled()) {
>> +        char buf[sizeof("false\n")];
>> +        uint32_t keys;
>> +        FILE *fd;
>
> For starters, reasonably complex kvm-only code like this should go
> into target/ppc/kvm.c.

Ok, will move the code there.

> But, there's a more fundamental problem.  Automatically adjusting
> guest visible parameters based on the host's capabilities is really
> problematic: if you migrate to a host with different capabilities
> what's usable suddenly changes, but the guest can't know.
>
> The usual way to deal with this is instead to have explicit machine
> parameters to control the value, and check if those are possible on
> the host.  It's then up to the user and/or management layer to set the
> parameters suitable to allow migration between all machines that they
> care about.

Good point, I hadn't thought of it. I will add the machine parameter
then and send a v2. Can the default value of the parameter be what is
supported by the host? 

-- 
Thiago Jung Bauermann
IBM Linux Technology Center

  reply	other threads:[~2017-08-23 23:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-21 20:00 [Qemu-devel] [PATCH] spapr: Add ibm, processor-storage-keys property to CPU DT node Thiago Jung Bauermann
2017-08-22  2:02 ` David Gibson
2017-08-23 23:14   ` Thiago Jung Bauermann [this message]
2017-08-24  1:34     ` David Gibson
2017-08-22  7:17 ` no-reply
2017-08-24  2:54 ` Paul Mackerras
2017-08-24  4:02   ` David Gibson
2017-08-24  4:15     ` Paul Mackerras
2017-08-24  4:27       ` David Gibson
2017-08-24 18:11   ` Ram Pai
2017-08-25  4:23     ` David Gibson
2017-08-28 17:50       ` Ram Pai
2017-08-29  1:57         ` David Gibson
2017-08-28 17:53   ` Ram Pai
2017-08-29  1:40     ` David Gibson
2017-08-29 16:31       ` Ram Pai
2017-08-30  0:43         ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y3q9q3l3.fsf@linux.vnet.ibm.com \
    --to=bauerman@linux.vnet.ibm.com \
    --cc=agraf@suse.de \
    --cc=david@gibson.dropbear.id.au \
    --cc=linuxram@us.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.