From: David Hildenbrand <david@redhat.com>
To: Thomas Huth <thuth@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org, Richard Henderson <rth@twiddle.net>,
Alexander Graf <agraf@suse.de>,
cohuck@redhat.com, Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH v1 2/2] s390x/tcg: low-address protection support
Date: Wed, 18 Oct 2017 21:34:07 +0200 [thread overview]
Message-ID: <45f91319-3fe3-403d-1c79-af1ce33b49ed@redhat.com> (raw)
In-Reply-To: <8dd3c355-7d91-e1bb-b7d6-4d3e3e213da3@redhat.com>
On 18.10.2017 20:21, Thomas Huth wrote:
> On 16.10.2017 22:23, David Hildenbrand wrote:
>> This is a neat way to implement low address protection, whereby
>> only the first 512 bytes of the first two pages (each 4096 bytes) of
>> every address space are protected.
>>
>> Store a tec of 0 for the access exception, this is what is defined by
>> Enhanced Suppression on Protection in case of a low address protection
>> (Bit 61 set to 0, rest undefined).
>>
>> We have to make sure to to pass the access address, not the masked page
>> address into mmu_translate*().
>>
>> Drop the check from testblock. So we can properly test this via
>> kvm-unit-tests.
>>
>> This will check every access going through one of the MMUs.
>>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>> target/s390x/excp_helper.c | 3 +-
>> target/s390x/mem_helper.c | 8 ----
>> target/s390x/mmu_helper.c | 94 +++++++++++++++++++++++++++++-----------------
>> 3 files changed, 60 insertions(+), 45 deletions(-)
> [...]
>> diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c
>> index 9daa0fd8e2..9806685bee 100644
>> --- a/target/s390x/mmu_helper.c
>> +++ b/target/s390x/mmu_helper.c
>> @@ -106,6 +106,35 @@ static void trigger_page_fault(CPUS390XState *env, target_ulong vaddr,
>> trigger_access_exception(env, type, ilen, tec);
>> }
>>
>> +/* check whether the address would be proteted by Low-Address Protection */
>> +static bool is_low_address(uint64_t addr)
>> +{
>> + return addr < 512 || (addr >= 4096 && addr <= 4607);
>> +}
>
> Just cosmetic, but I'd rather either use "<=" or "<" both times, so:
>
> return addr <= 511 || (addr >= 4096 && addr <= 4607);
>
That one then, as it matches the wording in the PoP.
>> + /* Check the private-space control bit */
>> + switch (asc) {
>> + case PSW_ASC_PRIMARY:
>> + return !(env->cregs[1] & _ASCE_PRIVATE_SPACE);
>> + case PSW_ASC_SECONDARY:
>> + return !(env->cregs[7] & _ASCE_PRIVATE_SPACE);
>> + case PSW_ASC_HOME:
>> + return !(env->cregs[13] & _ASCE_PRIVATE_SPACE);
>> + default:
>> + g_assert_not_reached();
>
> Well, this is certainly reachable - if the guest was running in access
> register mode. So it might be nicer to the user if you keep the
> error_report() here?
Right, this would be reachable via translate_pages(), but not via the
tlb. Although unlikely to hit it at that point, we can keep the error.
Conny, can you fix these two up or do you want me to resend?
--
Thanks,
David
next prev parent reply other threads:[~2017-10-18 19:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-16 20:23 [Qemu-devel] [PATCH v1 0/2] s390x/tcg: LAP support using immediate TLB invalidation David Hildenbrand
2017-10-16 20:23 ` [Qemu-devel] [PATCH v1 1/2] accel/tcg: allow to invalidate a write TLB entry immediately David Hildenbrand
2017-10-16 20:23 ` [Qemu-devel] [PATCH v1 2/2] s390x/tcg: low-address protection support David Hildenbrand
2017-10-18 18:21 ` Thomas Huth
2017-10-18 19:34 ` David Hildenbrand [this message]
2017-10-19 8:56 ` Cornelia Huck
2017-10-19 15:54 ` David Hildenbrand
2017-10-17 8:47 ` [Qemu-devel] [PATCH v1 0/2] s390x/tcg: LAP support using immediate TLB invalidation Cornelia Huck
2017-10-17 9:22 ` David Hildenbrand
2017-10-17 9:35 ` Cornelia Huck
2017-10-17 12:17 ` Cornelia Huck
2017-10-20 8:25 ` Cornelia Huck
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=45f91319-3fe3-403d-1c79-af1ce33b49ed@redhat.com \
--to=david@redhat.com \
--cc=agraf@suse.de \
--cc=cohuck@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
--cc=thuth@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).