Received: by 10.213.65.68 with SMTP id h4csp400389imn; Fri, 23 Mar 2018 07:04:53 -0700 (PDT) X-Google-Smtp-Source: AG47ELsHEEKCjWyrtB7KPPdAuAGZE7VGOywCKfkcDoxozt7fzSPtE1qE0JlQEaZA6wja6k9GcVuw X-Received: by 10.99.106.202 with SMTP id f193mr21584813pgc.334.1521813893909; Fri, 23 Mar 2018 07:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521813893; cv=none; d=google.com; s=arc-20160816; b=uDeq9kiDVEDVuhbD26333n5Ub58AVyE38JsEXfrKKNcCNQO9oIx5lG0d/8pfo8FIFf 4QIaJIjBlbvigQOeKnZ69UXCmkYZg+PhZe+sJhPDsCKvtp2zam5/hODWALyPKi+/e+bU FXHufHSMdgFDz4GF6AQtJd2K/VRAJhJytFqPee1Xl6eU51nbq3VdxgISUPe34xe2GlpL YcbncfITWVvTfPiWiIVSdYr9G2ti5uZB0gdq7uMK1ywmG5hWx3cDQkbobPFZ7+JCKWVS jh1zynSxdPlFyFLTPtvlyBChNgXEh5wDo0rMpfxO3+20XwczFlZed5FgOh/ynjH5HTB1 o26g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=jIzOTs/Q7rGuMD7S4rD5lFbJrV0VqA9W5tFbvwbGesc=; b=c6KLLzRM2Uu0FDRMX87VWL/AIMFBOtpJJAiQe5K/k0hMLDQ4iD755uOEwG07zGItg/ q3JE3Do4NYS82bqtnW39PBFN2+CsqgL3Hy9eEHDr6c1ROfrgXfY1jTXlcX/u72e6acAj +/CG4PmkPEDRJM0CfjS8wTu8OPMvPczU0IqSlhs6Ml7qo9tjSpdchSA8fLgPRSG1V0/g EEZzQVQKMSS6dalG4YcfHrb7EjFnTedD16vpiiZ7brelpM3k4eQH5eEpEvheidUQ1aH9 H16XE9tYIGiRaGyrdbESj5HsM8YFF7LlfE3lflXjvLwystRXCAMLx48JMWhHYeLpUnxN tJAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XU8qAtHj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8-v6si9477080pli.445.2018.03.23.07.04.22; Fri, 23 Mar 2018 07:04:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XU8qAtHj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752935AbeCWOB4 (ORCPT + 99 others); Fri, 23 Mar 2018 10:01:56 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:40575 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752525AbeCWOBz (ORCPT ); Fri, 23 Mar 2018 10:01:55 -0400 Received: by mail-ot0-f193.google.com with SMTP id l12-v6so13330744otj.7 for ; Fri, 23 Mar 2018 07:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=jIzOTs/Q7rGuMD7S4rD5lFbJrV0VqA9W5tFbvwbGesc=; b=XU8qAtHj+LOztaSKYQeYWCbb57a7uBMJkAETJGXL6S0o42t6tBmywcoNJmE5saYquD 8NQYyQhCtZn6rkhWhdoJ0+fwDUCIyyk0uwTN7JGkffuO1KWQTxFEzbddv1gYHz7SD9uG +njosIIzLVQ3zvt4Jn5RPHEApikr8T0YMvqi0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jIzOTs/Q7rGuMD7S4rD5lFbJrV0VqA9W5tFbvwbGesc=; b=q2Yhs0t0xJi1ciaceLmj0RwY07cJKkUPs8oTCqMqLZltMMyxcwi7IRn9tvPmehWO5O wP6bfWBZCubQ+4pyj4QxxRJGVMCGUx3fhT2EFXARJzWqZdKQh6eRqbJfheihIpfnwHZ+ HfKq4NfQ3nDUknC50qrxNFdu7uFyeorKt4Hfr3iuiZpQOjCcA/iojsX6cOEVQNf0zb4l Yj4i52psiA8vN6OgUvKCgJrsQlaFR6guzBuYDW9QVAtu7CItQz7KfjrCM7Vof8mxINOm bzU5HnzNnMFglVnV35NdL8ZYgfwAOzkTyomdyavhZfmqHMZUUBZ0psDv/EFp9P0GbFh4 zkxA== X-Gm-Message-State: AElRT7FZ0/S44VjT5fGrwjAoHFAWxpMMHkJpeBjY/cV6aARwAmD1W4U9 8C+4NGHhdU23ziRYGUmkQoA1WAFXjfaoWY0d/Zi4xg== X-Received: by 2002:a9d:2ff2:: with SMTP id b47-v6mr14061778otd.316.1521813713487; Fri, 23 Mar 2018 07:01:53 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:2286:0:0:0:0:0 with HTTP; Fri, 23 Mar 2018 07:01:33 -0700 (PDT) In-Reply-To: <1521451220-27754-3-git-send-email-eric.auger@redhat.com> References: <1521451220-27754-1-git-send-email-eric.auger@redhat.com> <1521451220-27754-3-git-send-email-eric.auger@redhat.com> From: Peter Maydell Date: Fri, 23 Mar 2018 14:01:33 +0000 Message-ID: Subject: Re: [RFC 02/12] KVM: arm/arm64: Document KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION To: Eric Auger Cc: Eric Auger , lkml - Kernel Mailing List , kvm-devel , kvmarm@lists.cs.columbia.edu, Marc Zyngier , Christoffer Dall , Andre Przywara , Andrew Jones , Wei Huang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19 March 2018 at 09:20, Eric Auger wrote: > We introduce a new KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION attribute in > KVM_DEV_ARM_VGIC_GRP_ADDR group. It allows userspace to provide the > base address and size of a redistributor region > > Compared to KVM_VGIC_V3_ADDR_TYPE_REDIST, this new attribute allows > to declare several separate redistributor regions. > > So the whole redist space does not need to be contiguous anymore. > > Signed-off-by: Eric Auger > --- > Documentation/virtual/kvm/devices/arm-vgic-v3.txt | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/Documentation/virtual/kvm/devices/arm-vgic-v3.txt b/Documentation/virtual/kvm/devices/arm-vgic-v3.txt > index 9293b45..2c0bedf 100644 > --- a/Documentation/virtual/kvm/devices/arm-vgic-v3.txt > +++ b/Documentation/virtual/kvm/devices/arm-vgic-v3.txt > @@ -27,6 +27,18 @@ Groups: > VCPU and all of the redistributor pages are contiguous. > Only valid for KVM_DEV_TYPE_ARM_VGIC_V3. > This address needs to be 64K aligned. > + > + KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION (rw, 64-bit) > + The attr field of kvm_device_attr encodes 3 values: > + bits: | 63 .... 52 | 51 .... 12 |11 - 0 > + values: | pfns | base | index > + - index encodes the unique redistibutor region index "redistributor" > + - base field encodes bits [51:12] the guest physical base address "of the guest" > + of the first redistributor in the region. There are two 64K pages > + for each VCPU and all of the redistributor pages are contiguous > + within the redistributor region. > + - pfns encodes the size of the region in 64kB pages. > + Only valid for KVM_DEV_TYPE_ARM_VGIC_V3. You should say something here about what happens if userspace tries to use both KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION and KVM_VGIC_V3_ADDR_TYPE_REDIST. I think this should be an error (reported by whichever of the two you try to set second). > Errors: > -E2BIG: Address outside of addressable IPA range > -EINVAL: Incorrectly aligned address Marc wrote: > Why does base have to include bits [15:12] of the IPA? If it is 64kB > aligned (as it should), these bits are guaranteed to be 0. This also > avoid having to return -EINVAL in case of alignment problems. If you're not using the bits for anything else you want to check they're 0 anyway. Otherwise we can't guarantee to safely use them for something else in future, because userspace might be handing us garbage in those bits without noticing. thanks -- PMM