Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp878089ybt; Tue, 7 Jul 2020 02:28:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRzfh1jqYGoeXoipaW5jQ4m6rHh/HJnvj0w93zKJOH6K2JrykhArSQfXOsxWrwsg6fRFaz X-Received: by 2002:a05:6402:1757:: with SMTP id v23mr45674844edx.356.1594114111395; Tue, 07 Jul 2020 02:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594114111; cv=none; d=google.com; s=arc-20160816; b=DIdDwb12zQFrCSr5qHH9fheDL40HmVLZFwSC1UoNyI7weGSxBCzj03YkhXOwaUiNqo x8L2zry6X96x7pKMrAKPhp5IXQB3p98H9McLcDvpBZbgprmpigyqjPaMOIlAmZWLh/1K 6489yT7Pz8CkK7xbcFWd1fSqcmT20ltFphcUmfK26DOWuzK+Asp2WlBhHjWHfUXMxk6j +dhuM86d5KKZGnDu0jcXrlXL62dSNQ5t+azwt5LOM/NVMWz/jQrSkxtVs6jEHM6tdQBk KRoVjROrScO43ygXSU0+L4Z6vK8zVyLw1WYCr++/nUmFzB7d9QyI7SIgwKH2YPrzrNdh 9DNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=TOdN6oueiJxGC26XWRVlU9vS6Ei4rnzo4eoopPeqQeU=; b=j5aL0EvuhVJjjgFgcfqF7U59yDIuK46IsWI/UDZqHRpQbnKbNgbltqpDFbRsXgmDoW 8VJkoJye743tmJRqPijX6OgFizSjk1NgNtG5ZK3Q/mcPziUHBLL4o53V2MU5PzMsVXpG 1dfL7URJUKaxpKf1/GQPsjK11J8bFozMZ6exbQEhMrYRIzAHbFv+/7aNa5rtILIf+k8a TB4mM75CxY8YERGQ0gxgJ8jMj2h1XXfncBKsJG967vD2LJcR7KXfexbT4csuHXxediCV UpVpkJp7MFDETljXCCTd7m8y3lVVQYAdaWMJdasjIimbACip3OHANvSx7LlsWThjmgC6 2r9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KEHqthmp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce9si15818735edb.70.2020.07.07.02.28.07; Tue, 07 Jul 2020 02:28:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KEHqthmp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727850AbgGGJ1J (ORCPT + 99 others); Tue, 7 Jul 2020 05:27:09 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:58667 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726540AbgGGJ1J (ORCPT ); Tue, 7 Jul 2020 05:27:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594114028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TOdN6oueiJxGC26XWRVlU9vS6Ei4rnzo4eoopPeqQeU=; b=KEHqthmpV0ju5e1zeIDCinEK6+DWuaFcdgzXLGduysfuYaVo95gEEBWVKI/9jSd/WbSH48 7TH0+S6kYQn/sHuLlvPBEwzLsxMtwk5nqBhSLLGPjzrpZFy+AAYsBQJxHE64few1vGgfPI Jnlm7/a+dJi12VfdjPhZDFsD7UJbHa0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-309-_ge2CFzUMZOYaw2qde8EQA-1; Tue, 07 Jul 2020 05:27:03 -0400 X-MC-Unique: _ge2CFzUMZOYaw2qde8EQA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D14F5800406; Tue, 7 Jul 2020 09:27:00 +0000 (UTC) Received: from gondolin (ovpn-113-54.ams2.redhat.com [10.36.113.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE25A60E3E; Tue, 7 Jul 2020 09:26:54 +0000 (UTC) Date: Tue, 7 Jul 2020 11:26:52 +0200 From: Cornelia Huck To: Pierre Morel Cc: linux-kernel@vger.kernel.org, pasic@linux.ibm.com, borntraeger@de.ibm.com, frankja@linux.ibm.com, mst@redhat.com, jasowang@redhat.com, kvm@vger.kernel.org, linux-s390@vger.kernel.org, virtualization@lists.linux-foundation.org, thomas.lendacky@amd.com, david@gibson.dropbear.id.au, linuxram@us.ibm.com, heiko.carstens@de.ibm.com, gor@linux.ibm.com Subject: Re: [PATCH v4 1/2] virtio: let arch validate VIRTIO features Message-ID: <20200707112652.42fcab80.cohuck@redhat.com> In-Reply-To: <1594111477-15401-2-git-send-email-pmorel@linux.ibm.com> References: <1594111477-15401-1-git-send-email-pmorel@linux.ibm.com> <1594111477-15401-2-git-send-email-pmorel@linux.ibm.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 7 Jul 2020 10:44:36 +0200 Pierre Morel wrote: > An architecture may need to validate the VIRTIO devices features > based on architecture specificities. s/specifities/specifics/ > > Signed-off-by: Pierre Morel > --- > drivers/virtio/virtio.c | 19 +++++++++++++++++++ > include/linux/virtio_config.h | 1 + > 2 files changed, 20 insertions(+) > > diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c > index a977e32a88f2..3179a8aa76f5 100644 > --- a/drivers/virtio/virtio.c > +++ b/drivers/virtio/virtio.c > @@ -167,6 +167,21 @@ void virtio_add_status(struct virtio_device *dev, unsigned int status) > } > EXPORT_SYMBOL_GPL(virtio_add_status); > > +/* > + * arch_needs_virtio_iommu_platform - provide arch specific hook when finalizing s/arch_needs_virtio_iommu_platform/arch_validate_virtio_features/ :) > + * features for VIRTIO device dev > + * @dev: the VIRTIO device being added > + * > + * Permits the platform to provide architecture specific functionality when s/provide architecture specific functionality/handle architecture-specific requirements/ ? > + * devices features are finalized. This is the default implementation. s/devices/device/ > + * Architecture implementations can override this. > + */ > + > +int __weak arch_validate_virtio_features(struct virtio_device *dev) > +{ > + return 0; > +} > + > int virtio_finalize_features(struct virtio_device *dev) > { > int ret = dev->config->finalize_features(dev); > @@ -176,6 +191,10 @@ int virtio_finalize_features(struct virtio_device *dev) > if (ret) > return ret; > > + ret = arch_validate_virtio_features(dev); > + if (ret) > + return ret; > + > if (!virtio_has_feature(dev, VIRTIO_F_VERSION_1)) > return 0; > > diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h > index bb4cc4910750..3f4117adf311 100644 > --- a/include/linux/virtio_config.h > +++ b/include/linux/virtio_config.h > @@ -459,4 +459,5 @@ static inline void virtio_cwrite64(struct virtio_device *vdev, > _r; \ > }) > > +int arch_validate_virtio_features(struct virtio_device *dev); > #endif /* _LINUX_VIRTIO_CONFIG_H */ With the wording fixed, Reviewed-by: Cornelia Huck