Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1271111ybt; Thu, 9 Jul 2020 02:59:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4Dne3JZ2Oz9PGsuFHxlNZ4Q46akoH1a0JTKk0RewiXaI0PyGbjsuTmfAbMoSqTlinltxB X-Received: by 2002:a17:906:2c43:: with SMTP id f3mr55045640ejh.38.1594288757682; Thu, 09 Jul 2020 02:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594288757; cv=none; d=google.com; s=arc-20160816; b=neOq74TQtPeQPm2EB6Y1NMrS2MDYUCO5grvcniXDHF3PKUa0rzZ7ANQa+uCagvT/9j sj5P7aDRLrKHfR5x/Sv4nBCFjpTRPaRl0UtWDMuYp/6cKLL5uFnKUXpDB8+nu0Fq3/mU rjAn37dSWviFvLSrTRd4KItVNcERdbXc6b2jOPALV0XpSXrWQlu/DaspgSx1Tg9xZke2 rXmi3iQyN7kKHLFkAiA/SaOZYzy9Oyl7bU8SZKw72b4Ov7SwgOiUN3i4cxRRsVK7Sjnq kGrAjTmjokVB43K7fPme+mNXeLrmVg9jfEuCjv/a0tPvBIHIpYKGbv3EWFxDaeGKkRD6 dXBw== 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; bh=8zcUeO/QxTndTwc7KiceM86MjyvJUAhX8ylrSgMn3gc=; b=mdDQxhRd7b8DO5lC+A6N3bHv/Ku4BEUDa2XFbMSqr8hIg7lSP7Xmi1y2z62mcdW/Fu hRQyJjJU4X46THrHsB+nMiA05pAcTEL8u9iln7oYdE13UXMoIv5IJFkCAtuiV7ewDYt5 uoWF8+uebClF3Wx7TzvCbqeYPFaW1FaaG3GWqucQW7sW93bCleae8U/SgOBgylcTQLE0 h5jW/yE5i+qYGakp6HDLf9qfbpwtPQF8UlkxSoaHjR07xSB1N+QpOFre1DjE9C7zfWGO LuzkrN429e+V+HPie9o2jckUx3qzXyrkmhUgfKCNnH6sVRALBSKiuakKS1UprIEJDx7o dQYg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si1677664eds.524.2020.07.09.02.58.54; Thu, 09 Jul 2020 02:59:17 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726510AbgGIJ6e (ORCPT + 99 others); Thu, 9 Jul 2020 05:58:34 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:24858 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726315AbgGIJ6d (ORCPT ); Thu, 9 Jul 2020 05:58:33 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0699VbUv079792; Thu, 9 Jul 2020 05:58:26 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 325s3jmaxd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Jul 2020 05:58:26 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0699WLjf082593; Thu, 9 Jul 2020 05:58:26 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 325s3jmawr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Jul 2020 05:58:26 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0699tATe004821; Thu, 9 Jul 2020 09:58:24 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04ams.nl.ibm.com with ESMTP id 325u410d9t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Jul 2020 09:58:24 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0699wL3G62324748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Jul 2020 09:58:21 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 52D8C4C040; Thu, 9 Jul 2020 09:58:21 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8D91C4C044; Thu, 9 Jul 2020 09:58:20 +0000 (GMT) Received: from oc2783563651 (unknown [9.145.152.61]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 9 Jul 2020 09:58:20 +0000 (GMT) Date: Thu, 9 Jul 2020 11:58:00 +0200 From: Halil Pasic To: Pierre Morel Cc: linux-kernel@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com, mst@redhat.com, jasowang@redhat.com, cohuck@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 v5 1/2] virtio: let arch validate VIRTIO features Message-ID: <20200709115800.7a6e93c8.pasic@linux.ibm.com> In-Reply-To: <1594283959-13742-2-git-send-email-pmorel@linux.ibm.com> References: <1594283959-13742-1-git-send-email-pmorel@linux.ibm.com> <1594283959-13742-2-git-send-email-pmorel@linux.ibm.com> Organization: IBM X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-09_04:2020-07-08,2020-07-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 suspectscore=0 malwarescore=0 mlxscore=0 priorityscore=1501 impostorscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007090073 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 9 Jul 2020 10:39:18 +0200 Pierre Morel wrote: > An architecture may need to validate the VIRTIO devices features > based on architecture specifics. > > Signed-off-by: Pierre Morel > Reviewed-by: Cornelia Huck > Acked-by: Christian Borntraeger Acked-by: Halil Pasic > --- > 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..c4e14d46a5b6 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_validate_virtio_features - provide arch specific hook when finalizing > + * features for VIRTIO device dev > + * @dev: the VIRTIO device being added > + * > + * Permits the platform to handle architecture-specific requirements when > + * device features are finalized. This is the default implementation. > + * 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 */