From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52BCBC433F5 for ; Fri, 6 May 2022 14:14:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C49CB404D3; Fri, 6 May 2022 14:14:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ARQc-OXcrbFY; Fri, 6 May 2022 14:14:22 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 7B4BC40193; Fri, 6 May 2022 14:14:21 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3B275C0032; Fri, 6 May 2022 14:14:21 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id A4A97C002D for ; Fri, 6 May 2022 14:14:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 7CD3F41849 for ; Fri, 6 May 2022 14:14:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hhASfOVqX6CQ for ; Fri, 6 May 2022 14:14:18 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [170.10.129.74]) by smtp4.osuosl.org (Postfix) with ESMTPS id 6595641769 for ; Fri, 6 May 2022 14:14:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651846457; 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: in-reply-to:in-reply-to:references:references; bh=6EwxLss5z9pqfmNAfnE+750spjOXcHfkOQWWavm7Z64=; b=Po+Sszh3iBJkb4iPhqRWef617jkgSED5KvJgwzCYGqxF/zRc66HXbOIX+lerrd9kxo10sG T0Sw4w0ge8Lc3Vy4oOBkXYNBMOe4dbcaCJSS4+JQL+Xpu4Th56bhaXGqqWwyatZ6P0lMPB RMrjI25IjzPM0vrk/WeTdDDBnJEOpw8= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-629-JOl7y0ZTMU2Q4CKqjoBT5Q-1; Fri, 06 May 2022 10:14:15 -0400 X-MC-Unique: JOl7y0ZTMU2Q4CKqjoBT5Q-1 Received: by mail-ej1-f72.google.com with SMTP id sh14-20020a1709076e8e00b006f4a5de6888so4451561ejc.8 for ; Fri, 06 May 2022 07:14:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=6EwxLss5z9pqfmNAfnE+750spjOXcHfkOQWWavm7Z64=; b=s5ZvdpApaigd5PRaedmSo935Ha319OKjTuJtU6C3+CNxmbC57B4yTp8MpH/vQley6z 7vo86EEYXOaPBBjsapihky10M3Ery3kDWQEn4hE/Nhh1s0d+cWF064NiHSeI31zi30oh ipnJbCgvk6K0+FK+qeHoBOb4DrzmiJuac6DCYZBj9/agWC7fbaLBTDTGwztluaWuTA3g VpGNpYOAriU5pNLh0iyO+dN1Xf8npiwMd8r+xTdN5XBLvx9hGTRBQPSqTeRL9tRaV23O Dh7ZEuF4zskb2B2zJslwdi4Bny8NdYsnZBjmbhoTxs8+AGyp1c7iA7A/393fgcVwSmCn IAaA== X-Gm-Message-State: AOAM531k+QUn36YPUCzYlLLDp0ycWIbrkh5ql8XAW0tx5KVFnsc6MZXB /8ZLE7mC67xDtfyBWPcC1TpHVnF+P/sHBbcLBRpUj31fPvgiRxFh7g2cyhULPOpau6sd/nP8/ca 3bHEqEQpqWE6iV0/Uj9O4pUNkwOJ7PoZoCkKRUwl9wg== X-Received: by 2002:a17:907:1b1e:b0:6d7:31b0:e821 with SMTP id mp30-20020a1709071b1e00b006d731b0e821mr3152147ejc.334.1651846439148; Fri, 06 May 2022 07:13:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyckf4ruK6WdXTZnQq2U7aWMOvfIW+9+F+1UXGr2zoM6PiRjmvaqZw5/Ho5iGuSVQegyf/HHg== X-Received: by 2002:a17:907:1b1e:b0:6d7:31b0:e821 with SMTP id mp30-20020a1709071b1e00b006d731b0e821mr3152126ejc.334.1651846438898; Fri, 06 May 2022 07:13:58 -0700 (PDT) Received: from fedora (nat-2.ign.cz. [91.219.240.2]) by smtp.gmail.com with ESMTPSA id hf15-20020a1709072c4f00b006f3ef214e4asm1940876ejc.176.2022.05.06.07.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 07:13:58 -0700 (PDT) From: Vitaly Kuznetsov To: vdasa@vmware.com Subject: Re: [PATCH] VMCI: Add support for ARM64 In-Reply-To: <20220414193316.14356-1-vdasa@vmware.com> References: <20220414193316.14356-1-vdasa@vmware.com> Date: Fri, 06 May 2022 16:13:57 +0200 Message-ID: <87levezr2y.fsf@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=vkuznets@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: Vishnu Dasa , pv-drivers@vmware.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-kernel-review@vmware.com, Bryan Tan , Cyprien Laplace , linux-arm-kernel@lists.infradead.org X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" vdasa@vmware.com writes: > From: Vishnu Dasa > > Add support for ARM64 architecture so that the driver can now be built > and VMCI device can be used. > > Update Kconfig file to allow the driver to be built on ARM64 as well. > Fail vmci_guest_probe_device() on ARM64 if the device does not support > MMIO register access. Lastly, add virtualization specific barriers > which map to actual memory barrier instructions on ARM64, because it > is required in case of ARM64 for queuepair (de)queuing. > FWIW, it seems you're doing three things at once, better split this into a 3-patch series. > Reviewed-by: Bryan Tan > Reviewed-by: Cyprien Laplace > Signed-off-by: Vishnu Dasa > --- > drivers/misc/vmw_vmci/Kconfig | 2 +- > drivers/misc/vmw_vmci/vmci_guest.c | 4 ++++ > drivers/misc/vmw_vmci/vmci_queue_pair.c | 12 ++++++++++++ > 3 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/misc/vmw_vmci/Kconfig b/drivers/misc/vmw_vmci/Kconfig > index 605794aadf11..b6d4d7fd686a 100644 > --- a/drivers/misc/vmw_vmci/Kconfig > +++ b/drivers/misc/vmw_vmci/Kconfig > @@ -5,7 +5,7 @@ > > config VMWARE_VMCI > tristate "VMware VMCI Driver" > - depends on X86 && PCI > + depends on (X86 || ARM64) && !CPU_BIG_ENDIAN && PCI > help > This is VMware's Virtual Machine Communication Interface. It enables > high-speed communication between host and guest in a virtual > diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c > index 57a6157209a1..aa7b05de97dd 100644 > --- a/drivers/misc/vmw_vmci/vmci_guest.c > +++ b/drivers/misc/vmw_vmci/vmci_guest.c > @@ -614,6 +614,10 @@ static int vmci_guest_probe_device(struct pci_dev *pdev, > } > > if (!mmio_base) { > + if (IS_ENABLED(CONFIG_ARM64)) { > + dev_err(&pdev->dev, "MMIO base is invalid\n"); > + return -ENXIO; > + } > error = pcim_iomap_regions(pdev, BIT(0), KBUILD_MODNAME); > if (error) { > dev_err(&pdev->dev, "Failed to reserve/map IO regions\n"); > diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c > index 94ebf7f3fd58..8f2de1893245 100644 > --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c > +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c > @@ -2577,6 +2577,12 @@ static ssize_t qp_enqueue_locked(struct vmci_queue *produce_q, > if (result < VMCI_SUCCESS) > return result; > > + /* > + * This virt_wmb() ensures that data written to the queue > + * is observable before the new producer_tail is. > + */ > + virt_wmb(); > + > vmci_q_header_add_producer_tail(produce_q->q_header, written, > produce_q_size); > return written; > @@ -2620,6 +2626,12 @@ static ssize_t qp_dequeue_locked(struct vmci_queue *produce_q, > if (buf_ready < VMCI_SUCCESS) > return (ssize_t) buf_ready; > > + /* > + * This virt_rmb() ensures that data from the queue will be read > + * after we have determined how much is ready to be consumed. > + */ > + virt_rmb(); > + > read = (size_t) (buf_ready > buf_size ? buf_size : buf_ready); > head = vmci_q_header_consumer_head(produce_q->q_header); > if (likely(head + read < consume_q_size)) { -- Vitaly _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55A3DC433F5 for ; Fri, 6 May 2022 14:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NtBwxIOj3bxM/deLONefiEg2aPtIEVoUOCxRUJnBN4c=; b=avMAbHPn3O7Ayl HatKzfYjgHPwbqfRQJKSABk4SOOS1CEqYwsIYtB4e1p0qm3/3YhNpnsSQqRXEFFbIHxJI0G49Kjxw 3Ta/XUjbmuCt12nQYiyjflKtBArNhdk5FDn76EX38ITjYjm7vy2MDGc7/G5ELLhPbZr66NlypEDV4 rpVJb+gSp8celii6iKkT6NqKI4Grsio88/nboBZY5UWWhytjSaBPjmhTflb3W+wNFWXF6U2OYORDB w+xQIY4HefcYmNpPS2Qqdr4+1EsWeItrI1Wth2/p5HohYAe3KnAYwvMeUjy8I0yQSrp7HhFaji3+n 1jjN91n+9kq2K110xtSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmyit-003ikO-PC; Fri, 06 May 2022 14:14:24 +0000 Received: from us-smtp-delivery-74.mimecast.com ([170.10.129.74]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmyip-003ii1-9C for linux-arm-kernel@lists.infradead.org; Fri, 06 May 2022 14:14:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651846456; 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: in-reply-to:in-reply-to:references:references; bh=6EwxLss5z9pqfmNAfnE+750spjOXcHfkOQWWavm7Z64=; b=GZtbK2tpfuKEGIX0Syc7g4T19EuuHWtUTbSHDzn0vFTsfPE9HEqmpRpaPJI3Cqfla9gvIL 2JGUko5eXJmvciEkSFvAEtYWRvgl8dLyWhRAYKRvFURWH4EKd2bSKyYaDv4g2snfT1/x4X ScN8zqk6Cya79N+YfB+lMPPUmEvC0DM= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-629-ttzzuUFWP16GaomSLOqhYA-1; Fri, 06 May 2022 10:14:15 -0400 X-MC-Unique: ttzzuUFWP16GaomSLOqhYA-1 Received: by mail-ej1-f70.google.com with SMTP id qf19-20020a1709077f1300b006f439243355so4403308ejc.3 for ; Fri, 06 May 2022 07:14:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=6EwxLss5z9pqfmNAfnE+750spjOXcHfkOQWWavm7Z64=; b=1wY6bnBh8F7OkjaFTpxeIt7vUeeJQfdvw03jmuTVshVtDZG8yj0SmPTVbvrYnKJTQ+ V1tOPq8eTz0cni4hLPUxP9zvBISIy+9inLeQWvti+MJk6ucR6+rPO7whukoD66WwaT6O V6krrjzEK+IjHByAR0NyIUXPFt1cEWH96KGZ4p/RitH2lKpx6LYXcb3mGDeMvlQbq8AU 8ErTa7RWVSVVW3EaYf8T/QyLQ2F1fxS4QEctBm7PNxf14Dk5ewKdGxba/jSMPKaRiLRJ b3foQ/WacU3sAGfZeT+sPMkqHuxCLQwvO+KKqOI7cXClnDJA13Mi7yQo2Rqu8kdfd+7r l/Og== X-Gm-Message-State: AOAM531U2qQg0WDl/kT1tytvmiPX7SFfxPGIaH7f3yYVLZv5NHr/yjGP ncnKIb4azBEof67/sTdUzz41SR7Gsw07oqComGiwjuvZZqigJh5ukxb+w6s+N4ZCsx+b0uowmwQ nJB3ccKaJUb7XP2XynLttg6hPXiBsqKytLOIS26Saozh3kgFdBlPyjqtJ6Ar+tTrCJhJ++K74sx ODQfKr9G+1cyA= X-Received: by 2002:a17:907:1b1e:b0:6d7:31b0:e821 with SMTP id mp30-20020a1709071b1e00b006d731b0e821mr3152149ejc.334.1651846439187; Fri, 06 May 2022 07:13:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyckf4ruK6WdXTZnQq2U7aWMOvfIW+9+F+1UXGr2zoM6PiRjmvaqZw5/Ho5iGuSVQegyf/HHg== X-Received: by 2002:a17:907:1b1e:b0:6d7:31b0:e821 with SMTP id mp30-20020a1709071b1e00b006d731b0e821mr3152126ejc.334.1651846438898; Fri, 06 May 2022 07:13:58 -0700 (PDT) Received: from fedora (nat-2.ign.cz. [91.219.240.2]) by smtp.gmail.com with ESMTPSA id hf15-20020a1709072c4f00b006f3ef214e4asm1940876ejc.176.2022.05.06.07.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 07:13:58 -0700 (PDT) From: Vitaly Kuznetsov To: vdasa@vmware.com Cc: pv-drivers@vmware.com, linux-kernel-review@vmware.com, Cyprien Laplace , Vishnu Dasa , Bryan Tan , gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] VMCI: Add support for ARM64 In-Reply-To: <20220414193316.14356-1-vdasa@vmware.com> References: <20220414193316.14356-1-vdasa@vmware.com> Date: Fri, 06 May 2022 16:13:57 +0200 Message-ID: <87levezr2y.fsf@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=vkuznets@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220506_071419_416805_A81F810D X-CRM114-Status: GOOD ( 27.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org vdasa@vmware.com writes: > From: Vishnu Dasa > > Add support for ARM64 architecture so that the driver can now be built > and VMCI device can be used. > > Update Kconfig file to allow the driver to be built on ARM64 as well. > Fail vmci_guest_probe_device() on ARM64 if the device does not support > MMIO register access. Lastly, add virtualization specific barriers > which map to actual memory barrier instructions on ARM64, because it > is required in case of ARM64 for queuepair (de)queuing. > FWIW, it seems you're doing three things at once, better split this into a 3-patch series. > Reviewed-by: Bryan Tan > Reviewed-by: Cyprien Laplace > Signed-off-by: Vishnu Dasa > --- > drivers/misc/vmw_vmci/Kconfig | 2 +- > drivers/misc/vmw_vmci/vmci_guest.c | 4 ++++ > drivers/misc/vmw_vmci/vmci_queue_pair.c | 12 ++++++++++++ > 3 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/misc/vmw_vmci/Kconfig b/drivers/misc/vmw_vmci/Kconfig > index 605794aadf11..b6d4d7fd686a 100644 > --- a/drivers/misc/vmw_vmci/Kconfig > +++ b/drivers/misc/vmw_vmci/Kconfig > @@ -5,7 +5,7 @@ > > config VMWARE_VMCI > tristate "VMware VMCI Driver" > - depends on X86 && PCI > + depends on (X86 || ARM64) && !CPU_BIG_ENDIAN && PCI > help > This is VMware's Virtual Machine Communication Interface. It enables > high-speed communication between host and guest in a virtual > diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c > index 57a6157209a1..aa7b05de97dd 100644 > --- a/drivers/misc/vmw_vmci/vmci_guest.c > +++ b/drivers/misc/vmw_vmci/vmci_guest.c > @@ -614,6 +614,10 @@ static int vmci_guest_probe_device(struct pci_dev *pdev, > } > > if (!mmio_base) { > + if (IS_ENABLED(CONFIG_ARM64)) { > + dev_err(&pdev->dev, "MMIO base is invalid\n"); > + return -ENXIO; > + } > error = pcim_iomap_regions(pdev, BIT(0), KBUILD_MODNAME); > if (error) { > dev_err(&pdev->dev, "Failed to reserve/map IO regions\n"); > diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c > index 94ebf7f3fd58..8f2de1893245 100644 > --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c > +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c > @@ -2577,6 +2577,12 @@ static ssize_t qp_enqueue_locked(struct vmci_queue *produce_q, > if (result < VMCI_SUCCESS) > return result; > > + /* > + * This virt_wmb() ensures that data written to the queue > + * is observable before the new producer_tail is. > + */ > + virt_wmb(); > + > vmci_q_header_add_producer_tail(produce_q->q_header, written, > produce_q_size); > return written; > @@ -2620,6 +2626,12 @@ static ssize_t qp_dequeue_locked(struct vmci_queue *produce_q, > if (buf_ready < VMCI_SUCCESS) > return (ssize_t) buf_ready; > > + /* > + * This virt_rmb() ensures that data from the queue will be read > + * after we have determined how much is ready to be consumed. > + */ > + virt_rmb(); > + > read = (size_t) (buf_ready > buf_size ? buf_size : buf_ready); > head = vmci_q_header_consumer_head(produce_q->q_header); > if (likely(head + read < consume_q_size)) { -- Vitaly _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B11FC433EF for ; Fri, 6 May 2022 14:14:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442121AbiEFORs (ORCPT ); Fri, 6 May 2022 10:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352292AbiEFORp (ORCPT ); Fri, 6 May 2022 10:17:45 -0400 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [170.10.129.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EED3F68317 for ; Fri, 6 May 2022 07:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651846442; 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: in-reply-to:in-reply-to:references:references; bh=6EwxLss5z9pqfmNAfnE+750spjOXcHfkOQWWavm7Z64=; b=UU4bChygMyu6Q2KSaonmzzLdUevkH8oMIFDdBRT+Sog0Mlb00mU+tHfkfWymK4m8Qy8Dcp hXc2osSD+/URTfQfFlxKPdvMRHHTNLlQp5zC3nJlS+WftZdx97EdNQlQ7lv0umoTa/041i 3Q/Jcto6OrFir+VAEkZxCzUJdz9Kqwk= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-383-oaabJTABN3Kd8yISprFEqg-1; Fri, 06 May 2022 10:14:00 -0400 X-MC-Unique: oaabJTABN3Kd8yISprFEqg-1 Received: by mail-ej1-f71.google.com with SMTP id sd38-20020a1709076e2600b006f3e54b1dbcso2536952ejc.4 for ; Fri, 06 May 2022 07:14:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=6EwxLss5z9pqfmNAfnE+750spjOXcHfkOQWWavm7Z64=; b=6x/ckdrafJE0GMruBbbsvOF5ripXnllSuw3RZHG1ofhnH5RVxhTzqXHr1XQ8auALii npygG4CGQUpbHB8WEX67UUiuOUkbOr5ao/oZlt+xjTVdTqppupEU3atV6/e6JBA63Hlh X6wFb0Y7dscdcdCLnQQ99dswSqzxeHXBOlLAhR+cW7b7+PdOGP6hp0l38NalAUZPTTMF WPJwyhB7s0iv4x0spKVZccJ9Ss01TXXHAUzSsrop4uw9fyDV80n6fGexWRDvx5IOGHvw T6sLsInfJLt3p13iBgtFaJTuJH+lXGGQ45ZrFzdLy8xj5k6+F5x5jNZf0jVBdGRg3llF PLUA== X-Gm-Message-State: AOAM530goak+QPkCkLztH2yn04YlvQ3A5m8yk2wUH/DGBrhV9GDDGPTM Z4lCfnB5l9KyNhxh0aX6lPhozfH5RfM9ubkwwdVJD3hRoFUmLTcxjUQAjuD4cMiXHmAH7KTiZoI IqoiuoMH1tC/5pE02PzXfLHbf X-Received: by 2002:a17:907:1b1e:b0:6d7:31b0:e821 with SMTP id mp30-20020a1709071b1e00b006d731b0e821mr3152142ejc.334.1651846439145; Fri, 06 May 2022 07:13:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyckf4ruK6WdXTZnQq2U7aWMOvfIW+9+F+1UXGr2zoM6PiRjmvaqZw5/Ho5iGuSVQegyf/HHg== X-Received: by 2002:a17:907:1b1e:b0:6d7:31b0:e821 with SMTP id mp30-20020a1709071b1e00b006d731b0e821mr3152126ejc.334.1651846438898; Fri, 06 May 2022 07:13:58 -0700 (PDT) Received: from fedora (nat-2.ign.cz. [91.219.240.2]) by smtp.gmail.com with ESMTPSA id hf15-20020a1709072c4f00b006f3ef214e4asm1940876ejc.176.2022.05.06.07.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 07:13:58 -0700 (PDT) From: Vitaly Kuznetsov To: vdasa@vmware.com Cc: pv-drivers@vmware.com, linux-kernel-review@vmware.com, Cyprien Laplace , Vishnu Dasa , Bryan Tan , gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] VMCI: Add support for ARM64 In-Reply-To: <20220414193316.14356-1-vdasa@vmware.com> References: <20220414193316.14356-1-vdasa@vmware.com> Date: Fri, 06 May 2022 16:13:57 +0200 Message-ID: <87levezr2y.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org vdasa@vmware.com writes: > From: Vishnu Dasa > > Add support for ARM64 architecture so that the driver can now be built > and VMCI device can be used. > > Update Kconfig file to allow the driver to be built on ARM64 as well. > Fail vmci_guest_probe_device() on ARM64 if the device does not support > MMIO register access. Lastly, add virtualization specific barriers > which map to actual memory barrier instructions on ARM64, because it > is required in case of ARM64 for queuepair (de)queuing. > FWIW, it seems you're doing three things at once, better split this into a 3-patch series. > Reviewed-by: Bryan Tan > Reviewed-by: Cyprien Laplace > Signed-off-by: Vishnu Dasa > --- > drivers/misc/vmw_vmci/Kconfig | 2 +- > drivers/misc/vmw_vmci/vmci_guest.c | 4 ++++ > drivers/misc/vmw_vmci/vmci_queue_pair.c | 12 ++++++++++++ > 3 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/misc/vmw_vmci/Kconfig b/drivers/misc/vmw_vmci/Kconfig > index 605794aadf11..b6d4d7fd686a 100644 > --- a/drivers/misc/vmw_vmci/Kconfig > +++ b/drivers/misc/vmw_vmci/Kconfig > @@ -5,7 +5,7 @@ > > config VMWARE_VMCI > tristate "VMware VMCI Driver" > - depends on X86 && PCI > + depends on (X86 || ARM64) && !CPU_BIG_ENDIAN && PCI > help > This is VMware's Virtual Machine Communication Interface. It enables > high-speed communication between host and guest in a virtual > diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c > index 57a6157209a1..aa7b05de97dd 100644 > --- a/drivers/misc/vmw_vmci/vmci_guest.c > +++ b/drivers/misc/vmw_vmci/vmci_guest.c > @@ -614,6 +614,10 @@ static int vmci_guest_probe_device(struct pci_dev *pdev, > } > > if (!mmio_base) { > + if (IS_ENABLED(CONFIG_ARM64)) { > + dev_err(&pdev->dev, "MMIO base is invalid\n"); > + return -ENXIO; > + } > error = pcim_iomap_regions(pdev, BIT(0), KBUILD_MODNAME); > if (error) { > dev_err(&pdev->dev, "Failed to reserve/map IO regions\n"); > diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c > index 94ebf7f3fd58..8f2de1893245 100644 > --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c > +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c > @@ -2577,6 +2577,12 @@ static ssize_t qp_enqueue_locked(struct vmci_queue *produce_q, > if (result < VMCI_SUCCESS) > return result; > > + /* > + * This virt_wmb() ensures that data written to the queue > + * is observable before the new producer_tail is. > + */ > + virt_wmb(); > + > vmci_q_header_add_producer_tail(produce_q->q_header, written, > produce_q_size); > return written; > @@ -2620,6 +2626,12 @@ static ssize_t qp_dequeue_locked(struct vmci_queue *produce_q, > if (buf_ready < VMCI_SUCCESS) > return (ssize_t) buf_ready; > > + /* > + * This virt_rmb() ensures that data from the queue will be read > + * after we have determined how much is ready to be consumed. > + */ > + virt_rmb(); > + > read = (size_t) (buf_ready > buf_size ? buf_size : buf_ready); > head = vmci_q_header_consumer_head(produce_q->q_header); > if (likely(head + read < consume_q_size)) { -- Vitaly