From patchwork Wed Aug 26 14:36:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738529 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26CAD138A for ; Wed, 26 Aug 2020 14:38:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F11D622B40 for ; Wed, 26 Aug 2020 14:38:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NV67c+cv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F11D622B40 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwZD-0006Qt-7t for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:38:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwYU-0004p5-PE for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:37:40 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:57351 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwYR-0006CO-Pm for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:37:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452654; 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=cS+si9eh1bRTLeHNZhyjHNcMnCNz1d8mrD3qWaIpIXM=; b=NV67c+cvUOLHgtvjXw1d5zHwstFWhoeK9yzJHaCQ8SndQ/M25RRkhie2HkRS1pZf0DBCOb cAOYjxKp/G5uVuhftxDVWYRaI8A3g/8CfWEHeuF6r0IyW/DMtflqBv1aKH7fqq4UX/FEys kdAkvRQcQHhvzvmg6Z7RSweiPFyUqsE= 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-159-OvNetzbbO8uKTqRxVT4r6Q-1; Wed, 26 Aug 2020 10:37:29 -0400 X-MC-Unique: OvNetzbbO8uKTqRxVT4r6Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D71D1005E65; Wed, 26 Aug 2020 14:37:27 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id B189576E00; Wed, 26 Aug 2020 14:37:14 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 01/13] memory: Rename memory_region_notify_one to memory_region_notify_iommu_one Date: Wed, 26 Aug 2020 16:36:39 +0200 Message-Id: <20200826143651.7915-2-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=eperezma@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 03:56:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Previous name didn't reflect the iommu operation. Signed-off-by: Eugenio Pérez --- hw/arm/smmu-common.c | 2 +- hw/arm/smmuv3.c | 2 +- hw/i386/intel_iommu.c | 4 ++-- include/exec/memory.h | 6 +++--- softmmu/memory.c | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c index e13a5f4a7c..b02ffb8822 100644 --- a/hw/arm/smmu-common.c +++ b/hw/arm/smmu-common.c @@ -396,7 +396,7 @@ static void smmu_unmap_notifier_range(IOMMUNotifier *n) entry.perm = IOMMU_NONE; entry.addr_mask = n->end - n->start; - memory_region_notify_one(n, &entry); + memory_region_notify_iommu_one(n, &entry); } /* Unmap all notifiers attached to @mr */ diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index 57a79df55b..3bb85ab7e1 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -838,7 +838,7 @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr, entry.addr_mask = (1 << tt->granule_sz) - 1; entry.perm = IOMMU_NONE; - memory_region_notify_one(n, &entry); + memory_region_notify_iommu_one(n, &entry); } /* invalidate an asid/iova tuple in all mr's */ diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 5284bb68b6..2ad6b9d796 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3498,7 +3498,7 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) /* This field is meaningless for unmap */ entry.translated_addr = 0; - memory_region_notify_one(n, &entry); + memory_region_notify_iommu_one(n, &entry); start += mask; remain -= mask; @@ -3536,7 +3536,7 @@ static void vtd_address_space_refresh_all(IntelIOMMUState *s) static int vtd_replay_hook(IOMMUTLBEntry *entry, void *private) { - memory_region_notify_one((IOMMUNotifier *)private, entry); + memory_region_notify_iommu_one((IOMMUNotifier *)private, entry); return 0; } diff --git a/include/exec/memory.h b/include/exec/memory.h index 0cfe987ab4..22c5f564d1 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -226,7 +226,7 @@ enum IOMMUMemoryRegionAttr { * The IOMMU implementation must use the IOMMU notifier infrastructure * to report whenever mappings are changed, by calling * memory_region_notify_iommu() (or, if necessary, by calling - * memory_region_notify_one() for each registered notifier). + * memory_region_notify_iommu_one() for each registered notifier). * * Conceptually an IOMMU provides a mapping from input address * to an output TLB entry. If the IOMMU is aware of memory transaction @@ -1274,7 +1274,7 @@ void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr, IOMMUTLBEntry entry); /** - * memory_region_notify_one: notify a change in an IOMMU translation + * memory_region_notify_iommu_one: notify a change in an IOMMU translation * entry to a single notifier * * This works just like memory_region_notify_iommu(), but it only @@ -1285,7 +1285,7 @@ void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr, * replaces all old entries for the same virtual I/O address range. * Deleted entries have .@perm == 0. */ -void memory_region_notify_one(IOMMUNotifier *notifier, +void memory_region_notify_iommu_one(IOMMUNotifier *notifier, IOMMUTLBEntry *entry); /** diff --git a/softmmu/memory.c b/softmmu/memory.c index 70b93104e8..961c25b42f 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -1890,8 +1890,8 @@ void memory_region_unregister_iommu_notifier(MemoryRegion *mr, memory_region_update_iommu_notify_flags(iommu_mr, NULL); } -void memory_region_notify_one(IOMMUNotifier *notifier, - IOMMUTLBEntry *entry) +void memory_region_notify_iommu_one(IOMMUNotifier *notifier, + IOMMUTLBEntry *entry) { IOMMUNotifierFlag request_flags; hwaddr entry_end = entry->iova + entry->addr_mask; @@ -1927,7 +1927,7 @@ void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr, IOMMU_NOTIFIER_FOREACH(iommu_notifier, iommu_mr) { if (iommu_notifier->iommu_idx == iommu_idx) { - memory_region_notify_one(iommu_notifier, &entry); + memory_region_notify_iommu_one(iommu_notifier, &entry); } } } From patchwork Wed Aug 26 14:36:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738555 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC6A4138A for ; Wed, 26 Aug 2020 14:39:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B2E8B214F1 for ; Wed, 26 Aug 2020 14:39:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BHT026J7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2E8B214F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:54748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwaZ-0001Og-Oj for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:39:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwYX-0004sK-Rl for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:37:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40192) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwYW-0006Cd-Es for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:37:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452658; 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=myzuQLMFrzrzm+iQjl6HxCd2/viSh0aOZ9bTWanImV8=; b=BHT026J70uVOjV/gQy7OvD06bdjUl9b5B2JZMspjz6RSL8M//heHYbhyTpW9E8HE1dkeif qxZvpe/8sqjYQIsr1CkffLpoR/9AWgYUuInYmZWW1G3gL3HnKeBetZ0vCOBte9bji9D0AJ VEYBjqopj+/ZJPdAPXmK1DTKvoBxUHY= 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-491-ye5iZrQCM9O2I99XGP3gFQ-1; Wed, 26 Aug 2020 10:37:36 -0400 X-MC-Unique: ye5iZrQCM9O2I99XGP3gFQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C448980F043; Wed, 26 Aug 2020 14:37:34 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04B2D76E00; Wed, 26 Aug 2020 14:37:27 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 02/13] memory: Add IOMMUTLBNotificationType to IOMMUTLBEntry Date: Wed, 26 Aug 2020 16:36:40 +0200 Message-Id: <20200826143651.7915-3-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/25 23:30:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This way we can tell between MAPs and UNMAP, and potentially avoid to send them to a notifier that does not require them. Signed-off-by: Eugenio Pérez --- include/exec/memory.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 22c5f564d1..f6d91c54aa 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -59,6 +59,12 @@ struct ReservedRegion { typedef struct IOMMUTLBEntry IOMMUTLBEntry; +typedef enum { + IOMMU_IOTLB_NONE = 0, + IOMMU_IOTLB_UNMAP = 1, + IOMMU_IOTLB_MAP = 2, +} IOMMUTLBNotificationType; + /* See address_space_translate: bit 0 is read, bit 1 is write. */ typedef enum { IOMMU_NONE = 0, @@ -70,11 +76,12 @@ typedef enum { #define IOMMU_ACCESS_FLAG(r, w) (((r) ? IOMMU_RO : 0) | ((w) ? IOMMU_WO : 0)) struct IOMMUTLBEntry { - AddressSpace *target_as; - hwaddr iova; - hwaddr translated_addr; - hwaddr addr_mask; /* 0xfff = 4k translation */ - IOMMUAccessFlags perm; + AddressSpace *target_as; + hwaddr iova; + hwaddr translated_addr; + hwaddr addr_mask; /* 0xfff = 4k translation */ + IOMMUAccessFlags perm; + IOMMUTLBNotificationType type; /* Only valid if it is a notification */ }; /* From patchwork Wed Aug 26 14:36:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738557 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 124AB138A for ; Wed, 26 Aug 2020 14:39:51 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD7BF221E2 for ; Wed, 26 Aug 2020 14:39:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dekTiL2X" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD7BF221E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwac-0001XY-3Z for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:39:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwYo-0005Pt-El for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:37:58 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:60479 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwYm-0006EI-IX for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:37:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452675; 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=JMsC3c9/DHjUOSpDAcJrFyNttzIeCnsKLwCmZ6jNiU0=; b=dekTiL2X/i7zvpLj2wL9OMeFyHPKqhuUk9rakvKxnis/PvtgKHigeDcgMfct1C5hkVmZHa 6QuaRyzvru8/4yvja2reoghaHqmtlbD+Gy6lulyC8udbdPvppOC7U1CaYTKccenOPn4Ph6 zoTbG7TXlQ7o1275fZSbR4KHEsmmrmE= 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-339-ydLYk1WANgaMukVqQFrxhg-1; Wed, 26 Aug 2020 10:37:53 -0400 X-MC-Unique: ydLYk1WANgaMukVqQFrxhg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 913221005E5B; Wed, 26 Aug 2020 14:37:50 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B6A276E00; Wed, 26 Aug 2020 14:37:34 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 03/13] hw/alpha/typhoon: Mark all IOMMUTLBEntry as IOMMU_IOTLB_NONE type Date: Wed, 26 Aug 2020 16:36:41 +0200 Message-Id: <20200826143651.7915-4-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 03:16:15 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Eugenio Pérez --- hw/alpha/typhoon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c index 29d44dfb06..b1e6c4e929 100644 --- a/hw/alpha/typhoon.c +++ b/hw/alpha/typhoon.c @@ -615,6 +615,7 @@ static bool make_iommu_tlbe(hwaddr taddr, hwaddr mask, IOMMUTLBEntry *ret) .translated_addr = taddr, .addr_mask = mask, .perm = IOMMU_RW, + .type = IOMMU_IOTLB_NONE, }; return true; } From patchwork Wed Aug 26 14:36:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738541 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 58C80138A for ; Wed, 26 Aug 2020 14:38:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3038A2177B for ; Wed, 26 Aug 2020 14:38:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Wrx/1haD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3038A2177B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwZV-0007G4-GG for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:38:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwYs-0005bT-W1 for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:38:03 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:57341 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwYr-0006F1-C5 for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:38:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452680; 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=rIhye1UWNZiZ/pCD75LUBoe0Ew+5jSd3Ovk1fJqErkE=; b=Wrx/1haDd6H/bVF44lUAgmic7XA/VcEj8lQIVnjuKYGIiEkEAqSQEdXA0dm9zrhoJT4DcT 03u627h/GcE1ltSHSui/GMahaIl6/FsyAeQM8iGZol4gBvedZ4PfWdzIiQ7roZ2CKLgEFr 0KCbgt173UeVNDgOio01b334koKK+vA= 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-507-j7lRtsR5N_GzUkHzB7zVQA-1; Wed, 26 Aug 2020 10:37:59 -0400 X-MC-Unique: j7lRtsR5N_GzUkHzB7zVQA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9CFCB81CAFA; Wed, 26 Aug 2020 14:37:57 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED08676E00; Wed, 26 Aug 2020 14:37:50 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 04/13] amd_iommu: Mark all IOMMUTLBEntry as IOMMU_IOTLB_NONE type Date: Wed, 26 Aug 2020 16:36:42 +0200 Message-Id: <20200826143651.7915-5-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 03:16:15 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Eugenio Pérez --- hw/i386/amd_iommu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 087f601666..c2607e9e91 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -946,6 +946,7 @@ static void amdvi_page_walk(AMDVIAddressSpace *as, uint64_t *dte, ret->translated_addr = (pte & AMDVI_DEV_PT_ROOT_MASK) & page_mask; ret->addr_mask = ~page_mask; ret->perm = amdvi_get_perms(pte); + ret->type = IOMMU_IOTLB_NONE; return; } no_remap: @@ -953,6 +954,7 @@ no_remap: ret->translated_addr = addr & AMDVI_PAGE_MASK_4K; ret->addr_mask = ~AMDVI_PAGE_MASK_4K; ret->perm = amdvi_get_perms(pte); + ret->type = IOMMU_IOTLB_NONE; } static void amdvi_do_translate(AMDVIAddressSpace *as, hwaddr addr, @@ -970,6 +972,7 @@ static void amdvi_do_translate(AMDVIAddressSpace *as, hwaddr addr, ret->translated_addr = iotlb_entry->translated_addr; ret->addr_mask = iotlb_entry->page_mask; ret->perm = iotlb_entry->perms; + ret->type = IOMMU_IOTLB_NONE; return; } @@ -994,6 +997,7 @@ out: ret->translated_addr = addr & AMDVI_PAGE_MASK_4K; ret->addr_mask = ~AMDVI_PAGE_MASK_4K; ret->perm = IOMMU_RW; + ret->type = IOMMU_IOTLB_NONE; } static inline bool amdvi_is_interrupt_addr(hwaddr addr) @@ -1011,7 +1015,8 @@ static IOMMUTLBEntry amdvi_translate(IOMMUMemoryRegion *iommu, hwaddr addr, .iova = addr, .translated_addr = 0, .addr_mask = ~(hwaddr)0, - .perm = IOMMU_NONE + .perm = IOMMU_NONE, + .type = IOMMU_IOTLB_NONE }; if (!s->enabled) { From patchwork Wed Aug 26 14:36:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738543 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 84F8A13A4 for ; Wed, 26 Aug 2020 14:38:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5CABA2224D for ; Wed, 26 Aug 2020 14:38:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LsjYs4M7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CABA2224D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:50164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwZl-0007yc-IH for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:38:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwZ6-00069X-HM for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:38:16 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:49811 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwZ4-0006Fb-TJ for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:38:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452694; 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=jv3tIIUr8czQPi8/wz1NY8KWW690wGow6avNY6L+3Zo=; b=LsjYs4M7ui61VIijYUo1aBGH8KFR/qAhcTeqkRFgAUBusiqqDCdM1VvoU1qFAIPfTf4WmM rY/o7/M4hADD/CJcDu8ZD76Z1ZiwoDP/7KECzhK/A2BuZ+Z4sccoCaiooNkQxXKghbD/Iq 4MDxXgfg/MQsHGqSBgP4G2AI2I5j3hU= 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-577-pev9AbiKOWOBu0jeG-W7EQ-1; Wed, 26 Aug 2020 10:38:12 -0400 X-MC-Unique: pev9AbiKOWOBu0jeG-W7EQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D972AE778; Wed, 26 Aug 2020 14:38:10 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03C4B76E00; Wed, 26 Aug 2020 14:37:57 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 05/13] hw/arm/smmu: Fill IOMMUTLBEntry notifier type Date: Wed, 26 Aug 2020 16:36:43 +0200 Message-Id: <20200826143651.7915-6-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=eperezma@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 03:56:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Eugenio Pérez --- hw/arm/smmu-common.c | 2 ++ hw/arm/smmuv3.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c index b02ffb8822..88cf1b86ea 100644 --- a/hw/arm/smmu-common.c +++ b/hw/arm/smmu-common.c @@ -181,6 +181,7 @@ static int smmu_ptw_64(SMMUTransCfg *cfg, tlbe->iova = iova; tlbe->addr_mask = (1 << granule_sz) - 1; + tlbe->type = IOMMU_IOTLB_NONE; while (level <= 3) { uint64_t subpage_size = 1ULL << level_shift(level, granule_sz); @@ -395,6 +396,7 @@ static void smmu_unmap_notifier_range(IOMMUNotifier *n) entry.iova = n->start; entry.perm = IOMMU_NONE; entry.addr_mask = n->end - n->start; + entry.type = IOMMU_IOTLB_UNMAP, memory_region_notify_iommu_one(n, &entry); } diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index 3bb85ab7e1..dee987b2b1 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -635,6 +635,7 @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr, .translated_addr = addr, .addr_mask = ~(hwaddr)0, .perm = IOMMU_NONE, + .type = IOMMU_IOTLB_NONE, }; SMMUIOTLBKey key, *new_key; @@ -837,6 +838,7 @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr, entry.iova = iova; entry.addr_mask = (1 << tt->granule_sz) - 1; entry.perm = IOMMU_NONE; + entry.type = IOMMU_NOTIFIER_UNMAP; memory_region_notify_iommu_one(n, &entry); } From patchwork Wed Aug 26 14:36:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738561 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14A51138A for ; Wed, 26 Aug 2020 14:40:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E044F208E4 for ; Wed, 26 Aug 2020 14:40:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eFV0m7Du" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E044F208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:59374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwbM-0003QG-4K for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:40:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwZE-0006Wg-ME for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:38:25 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:36952 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwZC-0006GJ-IR for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:38:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452701; 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=8ogInhxhGVOe9fq7mF9BUhjhOHksS03Mng4Dp3lrTtk=; b=eFV0m7DumOSml+qe8xAGrJGs3Q5F9pRcw04ay60jOdisXjo2oYH3IfSlpBluRgn+gmLz0w d6hkh/IW5NQ1fFBm9mkwgvZbAhTg+or61hbeJmKDXw2JijQ3uNuks1WqEruElvVEDzo46N bTrQ9Zqe06FyM2XKQnxgg0PFM6jNFJk= 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-480-6PmVQV6uNt2nOID7Xy9Zrw-1; Wed, 26 Aug 2020 10:38:19 -0400 X-MC-Unique: 6PmVQV6uNt2nOID7Xy9Zrw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 08A431005E5B; Wed, 26 Aug 2020 14:38:18 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41B1F76E00; Wed, 26 Aug 2020 14:38:11 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 06/13] dma/rc4030: Mark all IOMMUTLBEntry as IOMMU_IOTLB_NONE type Date: Wed, 26 Aug 2020 16:36:44 +0200 Message-Id: <20200826143651.7915-7-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 06:53:09 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Eugenio Pérez --- hw/dma/rc4030.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c index 7eddc9a776..8eee12b1cb 100644 --- a/hw/dma/rc4030.c +++ b/hw/dma/rc4030.c @@ -506,6 +506,7 @@ static IOMMUTLBEntry rc4030_dma_translate(IOMMUMemoryRegion *iommu, hwaddr addr, .translated_addr = 0, .addr_mask = DMA_PAGESIZE - 1, .perm = IOMMU_NONE, + .type = DEV_IOTLB_NONE, }; uint64_t i, entry_address; dma_pagetable_entry entry; From patchwork Wed Aug 26 14:36:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738567 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 50F2C138A for ; Wed, 26 Aug 2020 14:42:18 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2793C208E4 for ; Wed, 26 Aug 2020 14:42:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XDDfd3cG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2793C208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwcz-0006pz-E3 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:42:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwZQ-00073h-QT for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:38:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42022) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwZP-0006IK-3J for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:38:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452714; 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=2hgdZ+naDMWgqFeSjxulVyKtD+hCWh1JF39OFUlGgMw=; b=XDDfd3cGuyG7DfJq50SPk3+pV4QMMqeuI8U/JVr9gCCXR7nMqnbHoly0T3jQcqhA0/Ax2I fS2+5lyii1yFzYXt6OpZz2n+oxG1d0Q/3vM/a0DVwKTt4H3Jjsv2VAGY07Vq/1TltmTxOr 118rLUbqrivDHC8p6x79JbqEOvnWnys= 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-405-PQ4CSqT9NFKB9k62_SzH6A-1; Wed, 26 Aug 2020 10:38:33 -0400 X-MC-Unique: PQ4CSqT9NFKB9k62_SzH6A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B6FE8797C3; Wed, 26 Aug 2020 14:38:31 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6459C76E00; Wed, 26 Aug 2020 14:38:18 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 07/13] intel_iommu: Mark IOMMUTLBEntry of page notification as IOMMU_IOTLB_UNMAP type Date: Wed, 26 Aug 2020 16:36:45 +0200 Message-Id: <20200826143651.7915-8-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/25 23:30:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Eugenio Pérez --- hw/i386/intel_iommu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 2ad6b9d796..ed83e496b8 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -1999,6 +1999,7 @@ static void vtd_iotlb_page_invalidate_notify(IntelIOMMUState *s, .translated_addr = 0, .addr_mask = size - 1, .perm = IOMMU_NONE, + .type = IOMMU_IOTLB_UNMAP, }; memory_region_notify_iommu(&vtd_as->iommu, 0, entry); } @@ -2465,6 +2466,7 @@ static bool vtd_process_device_iotlb_desc(IntelIOMMUState *s, entry.iova = addr; entry.perm = IOMMU_NONE; entry.translated_addr = 0; + entry.type = IOMMU_IOTLB_UNMAP; memory_region_notify_iommu(&vtd_dev_as->iommu, 0, entry); done: @@ -3497,6 +3499,7 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) entry.perm = IOMMU_NONE; /* This field is meaningless for unmap */ entry.translated_addr = 0; + entry.type = IOMMU_NOTIFIER_UNMAP; memory_region_notify_iommu_one(n, &entry); From patchwork Wed Aug 26 14:36:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738573 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A5CF1138A for ; Wed, 26 Aug 2020 14:42:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D2AB208E4 for ; Wed, 26 Aug 2020 14:42:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gfPJN+1z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D2AB208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwdB-0007Ms-P3 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:42:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwZZ-0007Rm-G6 for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:38:45 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:33169 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwZW-0006J6-Mk for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:38:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452721; 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=RyWFcAK22ccrtFDCgblAv91X5355V0Mv2j3NgB49ZwY=; b=gfPJN+1zNM6uemPimbGip77AdXEunTxqxI7NGnbOPVUlKi4U40/MoQusK22Mk+XpwL5Cq5 T0qk+WhED/aHLSoxmQQAGAXcFbXuZh409re4zvuFHCOayaZMWpfYbwS5DLAK00XYanYqZU GXg0vtIYqHuLYnQ6wBJBPHrd8QRwkNw= 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-83-5C7OneFzP5KJ6GJjipw-3A-1; Wed, 26 Aug 2020 10:38:40 -0400 X-MC-Unique: 5C7OneFzP5KJ6GJjipw-3A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A3BB61074649; Wed, 26 Aug 2020 14:38:38 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id D69AE76E00; Wed, 26 Aug 2020 14:38:31 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 08/13] virtio-iommu: Mark virtio_iommu_translate IOTLB as IOMMU_IOTLB_NONE type Date: Wed, 26 Aug 2020 16:36:46 +0200 Message-Id: <20200826143651.7915-9-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=eperezma@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 03:56:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Eugenio Pérez --- hw/virtio/virtio-iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 5d56865e56..16267e8096 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -619,6 +619,7 @@ static IOMMUTLBEntry virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr, .translated_addr = addr, .addr_mask = (1 << ctz32(s->config.page_size_mask)) - 1, .perm = IOMMU_NONE, + .type = IOMMU_IOTLB_NONE, }; bypass_allowed = virtio_vdev_has_feature(&s->parent_obj, From patchwork Wed Aug 26 14:36:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738559 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E935913A4 for ; Wed, 26 Aug 2020 14:40:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C02DF214F1 for ; Wed, 26 Aug 2020 14:40:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jT4VNCd/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C02DF214F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwax-0002GF-0S for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:40:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwZo-000875-23 for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:39:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:52873) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwZm-0006KP-EG for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:38:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452737; 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=KaGyxX2iurcUU1VjRNA2tYBF2S9PFsb51ufyJr6sbM4=; b=jT4VNCd/YZwICgLTPg1Lt28TTP0MxkTS24ON0SmNSA88cvePFZRvecxWtk2r35i0NHPrXq r9dQAD+53FlUUb18e8zw8Sr/9gPVUbAR/IGSzYNkrmwSSm8RvPLD+ye3bao386Rju4z/n/ fop1AUvo2MW4nnUWHEN5y6d3w1Xns6w= 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-172-7KLE7cvNMXm15MpKIEaYMA-1; Wed, 26 Aug 2020 10:38:53 -0400 X-MC-Unique: 7KLE7cvNMXm15MpKIEaYMA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0DE9E801AE5; Wed, 26 Aug 2020 14:38:52 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B41576E00; Wed, 26 Aug 2020 14:38:38 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 09/13] intel_iommu: Set IOMMUTLBEntry type in vtd_page_walk_level Date: Wed, 26 Aug 2020 16:36:47 +0200 Message-Id: <20200826143651.7915-10-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 06:53:10 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Eugenio Pérez --- hw/i386/intel_iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index ed83e496b8..0b3399874f 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -1251,6 +1251,7 @@ static int vtd_page_walk_level(dma_addr_t addr, uint64_t start, entry.addr_mask = ~subpage_mask; /* NOTE: this is only meaningful if entry_valid == true */ entry.translated_addr = vtd_get_slpte_addr(slpte, info->aw); + entry.type = entry.perm ? IOMMU_IOTLB_MAP : IOMMU_IOTLB_UNMAP; ret = vtd_page_walk_one(&entry, info); } From patchwork Wed Aug 26 14:36:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738571 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 914B0138A for ; Wed, 26 Aug 2020 14:42:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 677AA208E4 for ; Wed, 26 Aug 2020 14:42:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="chlioOrU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 677AA208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwd3-00071O-L8 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:42:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwZz-0000CS-Hg for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:39:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24846) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwZx-0006MK-Rl for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:39:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452749; 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=g3dbNdcxxhQJeQFXVm5XbSPMbQBlA/yaWTXFikvO7So=; b=chlioOrU+Z19cBzDq/eSManqKyCycUr3OcqJpRgcLb2mvziEQNOlCJvTNnzs0luMB4QS3t fF2a8rVlDGdgCeoI4QKVEuU4Nwxw9vQh2OFVNt8NaUYJ+DCvA9Wl/lx4rG8zAZCfUm0VCI fH0aINCZtN+Qa5l/EiDgTHFNzVEjU3g= 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-267-boRpaYidMAWIyRUdxiGzbw-1; Wed, 26 Aug 2020 10:39:05 -0400 X-MC-Unique: boRpaYidMAWIyRUdxiGzbw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1A71C425D1; Wed, 26 Aug 2020 14:39:04 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6917776E00; Wed, 26 Aug 2020 14:38:52 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 10/13] memory: Notify IOMMU IOTLB based on entry type, not permissions Date: Wed, 26 Aug 2020 16:36:48 +0200 Message-Id: <20200826143651.7915-11-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/25 23:30:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This way the intention is much clearer. Signed-off-by: Eugenio Pérez --- softmmu/memory.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/softmmu/memory.c b/softmmu/memory.c index 961c25b42f..3e68442ca6 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -1890,10 +1890,27 @@ void memory_region_unregister_iommu_notifier(MemoryRegion *mr, memory_region_update_iommu_notify_flags(iommu_mr, NULL); } +static IOMMUNotifierFlag notifier_type_iommu(const IOMMUNotifier *notifier) +{ + return notifier->notifier_flags & IOMMU_NOTIFIER_ALL; +} + +static bool memory_region_notify(const IOMMUNotifier *notifier, + const IOMMUTLBEntry *entry) +{ + switch(entry->type) { + case IOMMU_IOTLB_MAP: + return notifier_type_iommu(notifier) == IOMMU_NOTIFIER_MAP; + case IOMMU_IOTLB_UNMAP: + return notifier_type_iommu(notifier) == IOMMU_NOTIFIER_UNMAP; + default: + return false; + }; +} + void memory_region_notify_iommu_one(IOMMUNotifier *notifier, IOMMUTLBEntry *entry) { - IOMMUNotifierFlag request_flags; hwaddr entry_end = entry->iova + entry->addr_mask; /* @@ -1906,13 +1923,7 @@ void memory_region_notify_iommu_one(IOMMUNotifier *notifier, assert(entry->iova >= notifier->start && entry_end <= notifier->end); - if (entry->perm & IOMMU_RW) { - request_flags = IOMMU_NOTIFIER_MAP; - } else { - request_flags = IOMMU_NOTIFIER_UNMAP; - } - - if (notifier->notifier_flags & request_flags) { + if (memory_region_notify(notifier, entry)) { notifier->notify(notifier, entry); } } From patchwork Wed Aug 26 14:36:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738577 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63E9413A4 for ; Wed, 26 Aug 2020 14:44:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 394CD208E4 for ; Wed, 26 Aug 2020 14:44:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bC0laIdu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 394CD208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwex-00029X-Eb for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:44:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwau-0002BZ-HN for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:40:08 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:40840 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwas-0006VF-Do for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:40:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452805; 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=EGQyeizi6c03BkZMJryn0YpKUk6Yr5XbAqCcSwva5kE=; b=bC0laIduY/xCLHLb4U4ktt5VCqtrfwdyZ3dIDilpIH/6ANBjlqD8PsGbUrADxhtejT/1n2 4NT+OOUeeXtvaKDLYCn1bPhHYa3purX44yh6Ip1P2pxWczaa+1z/7T7Kb1nQkTALOC8VRx R8IKZr133TnEFpJ09SdIrNFCPMtVBFU= 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-188-8T_E3lobOGGAeIU2wMT3vw-1; Wed, 26 Aug 2020 10:40:01 -0400 X-MC-Unique: 8T_E3lobOGGAeIU2wMT3vw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CD4B218BE165; Wed, 26 Aug 2020 14:39:57 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7577C7E46F; Wed, 26 Aug 2020 14:39:04 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 11/13] memory: Add IOMMU_DEVIOTLB_UNMAP IOMMUTLBNotificationType Date: Wed, 26 Aug 2020 16:36:49 +0200 Message-Id: <20200826143651.7915-12-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=eperezma@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 01:10:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Adapt intel and vhost to use this new notification type Signed-off-by: Eugenio Pérez --- hw/i386/intel_iommu.c | 2 +- hw/virtio/vhost.c | 2 +- include/exec/memory.h | 9 ++++++--- softmmu/memory.c | 5 ++++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 0b3399874f..ddb828da1f 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2467,7 +2467,7 @@ static bool vtd_process_device_iotlb_desc(IntelIOMMUState *s, entry.iova = addr; entry.perm = IOMMU_NONE; entry.translated_addr = 0; - entry.type = IOMMU_IOTLB_UNMAP; + entry.type = IOMMU_DEVIOTLB_UNMAP; memory_region_notify_iommu(&vtd_dev_as->iommu, 0, entry); done: diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 1a1384e7a6..6ca168b47e 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -729,7 +729,7 @@ static void vhost_iommu_region_add(MemoryListener *listener, iommu_idx = memory_region_iommu_attrs_to_index(iommu_mr, MEMTXATTRS_UNSPECIFIED); iommu_notifier_init(&iommu->n, vhost_iommu_unmap_notify, - IOMMU_NOTIFIER_UNMAP, + IOMMU_NOTIFIER_DEVIOTLB, section->offset_within_region, int128_get64(end), iommu_idx); diff --git a/include/exec/memory.h b/include/exec/memory.h index f6d91c54aa..477c3af24c 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -60,9 +60,10 @@ struct ReservedRegion { typedef struct IOMMUTLBEntry IOMMUTLBEntry; typedef enum { - IOMMU_IOTLB_NONE = 0, - IOMMU_IOTLB_UNMAP = 1, - IOMMU_IOTLB_MAP = 2, + IOMMU_IOTLB_NONE = 0, + IOMMU_IOTLB_UNMAP = 1, + IOMMU_IOTLB_MAP = 2, + IOMMU_DEVIOTLB_UNMAP = 3, } IOMMUTLBNotificationType; /* See address_space_translate: bit 0 is read, bit 1 is write. */ @@ -94,6 +95,8 @@ typedef enum { IOMMU_NOTIFIER_UNMAP = 0x1, /* Notify entry changes (newly created entries) */ IOMMU_NOTIFIER_MAP = 0x2, + /* Notify changes on device IOTLB entries */ + IOMMU_NOTIFIER_DEVIOTLB = 0x04, } IOMMUNotifierFlag; #define IOMMU_NOTIFIER_ALL (IOMMU_NOTIFIER_MAP | IOMMU_NOTIFIER_UNMAP) diff --git a/softmmu/memory.c b/softmmu/memory.c index 3e68442ca6..4ed63f4d0d 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -1892,7 +1892,8 @@ void memory_region_unregister_iommu_notifier(MemoryRegion *mr, static IOMMUNotifierFlag notifier_type_iommu(const IOMMUNotifier *notifier) { - return notifier->notifier_flags & IOMMU_NOTIFIER_ALL; + return notifier->notifier_flags & + (IOMMU_NOTIFIER_ALL | IOMMU_NOTIFIER_DEVIOTLB); } static bool memory_region_notify(const IOMMUNotifier *notifier, @@ -1903,6 +1904,8 @@ static bool memory_region_notify(const IOMMUNotifier *notifier, return notifier_type_iommu(notifier) == IOMMU_NOTIFIER_MAP; case IOMMU_IOTLB_UNMAP: return notifier_type_iommu(notifier) == IOMMU_NOTIFIER_UNMAP; + case IOMMU_DEVIOTLB_UNMAP: + return notifier_type_iommu(notifier) == IOMMU_NOTIFIER_DEVIOTLB; default: return false; }; From patchwork Wed Aug 26 14:36:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738575 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E3494138A for ; Wed, 26 Aug 2020 14:42:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B8295208E4 for ; Wed, 26 Aug 2020 14:42:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="afjQQ7vq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8295208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwdH-0007dh-Uz for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:42:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwb0-0002Ra-EU for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:40:14 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:34595 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwaw-0006Vl-Vr for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:40:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452810; 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=37E0YMA1qPtt1oyY6xJg1GUok8EqO/yvBOiRrB4VVfQ=; b=afjQQ7vqKNNWCs4/aBsYyvddBMlVPmkOeRgLslNly6b3rurraU7RiJw17hbND89SnkqugS BI5TsIoXRhr0d5mGxIQOhw5scVIJOnGiOnR151vwQd5vm+xGjBWNEGS2a8TL5LVzHDSEiN bIUpUir+giIuT17uALQTOhXWIblgpEY= 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-332-5R-aLHvMPNC-ipKTzLrgoA-1; Wed, 26 Aug 2020 10:40:08 -0400 X-MC-Unique: 5R-aLHvMPNC-ipKTzLrgoA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 25EC21006485; Wed, 26 Aug 2020 14:40:02 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id D38657D9A4; Wed, 26 Aug 2020 14:39:57 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 12/13] intel_iommu: Do not notify regular iotlb to device-iotlb notifiers Date: Wed, 26 Aug 2020 16:36:50 +0200 Message-Id: <20200826143651.7915-13-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=eperezma@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 01:10:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This improves performance in case of netperf with vhost-net: * TCP_STREAM: From 9049.59Mbit/s to 9049.59Mbit/s (13%) * TCP_RR: From 8464.73 trans/s to 8932.703333 trans/s (5.5%) * UDP_RR: From 8562.08 trans/s to 9005.62/s (5.1%) * UDP_STREAM: No change observed (insignificant 0.1% improvement) Signed-off-by: Eugenio Pérez --- hw/i386/intel_iommu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index ddb828da1f..7620a1abbf 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -1960,6 +1960,12 @@ static void vtd_iotlb_domain_invalidate(IntelIOMMUState *s, uint16_t domain_id) vtd_iommu_unlock(s); QLIST_FOREACH(vtd_as, &s->vtd_as_with_notifiers, next) { + if (vtd_as->iommu.iommu_notify_flags & IOMMU_NOTIFIER_DEVIOTLB) { + /* If IOMMU memory region is DEVICE IOTLB type, it does not make + * sense to send regular IOMMU notifications. */ + continue; + } + if (!vtd_dev_to_context_entry(s, pci_bus_num(vtd_as->bus), vtd_as->devfn, &ce) && domain_id == vtd_get_domain_id(s, &ce)) { From patchwork Wed Aug 26 14:36:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 11738579 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C48C7138A for ; Wed, 26 Aug 2020 14:44:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9AC34208E4 for ; Wed, 26 Aug 2020 14:44:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RTxmCG/2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9AC34208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:49212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAwf8-0002Lq-Ti for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Aug 2020 10:44:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAwb7-0002iq-8x for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:40:21 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:20914 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kAwb5-0006Wk-Gy for qemu-devel@nongnu.org; Wed, 26 Aug 2020 10:40:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598452818; 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=Y7WEAFw6lxhAjAKjrEuObXUZF982ZbZDNmE/a7NNAaA=; b=RTxmCG/23mbeNGla7mYanEj6L5wMjLh6qwzwt173sNc0D/L9Qgi1VTg+A/aEz5QjUWpRzn AIZ5YP02ezrVObqbmlJ7/cB6tWWCWdjOVdHSkwihZ7ksCOzB1BYxQFwHZKh3QWPM0tgDLC dfmvWHZGtvakMfmRpdyIehDqsRKylI4= 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-181-1LXAvbqFOiiz84R7l3VDpw-1; Wed, 26 Aug 2020 10:40:15 -0400 X-MC-Unique: 1LXAvbqFOiiz84R7l3VDpw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F8EC801ABC; Wed, 26 Aug 2020 14:40:06 +0000 (UTC) Received: from eperezma.remote.csb (ovpn-115-59.ams2.redhat.com [10.36.115.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 937ED8AC03; Wed, 26 Aug 2020 14:40:01 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org, Peter Xu Subject: [RFC v6 13/13] memory: Skip bad range assertion if notifier is DEVIOTLB type Date: Wed, 26 Aug 2020 16:36:51 +0200 Message-Id: <20200826143651.7915-14-eperezma@redhat.com> In-Reply-To: <20200826143651.7915-1-eperezma@redhat.com> References: <20200625191651.5817-1-eperezma@redhat.com> <20200826143651.7915-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eperezma@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 03:16:15 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , Yan Zhao , Eduardo Habkost , Juan Quintela , Jason Wang , "Michael S. Tsirkin" , Eric Auger , qemu-arm@nongnu.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Avi Kivity , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Eugenio Pérez --- softmmu/memory.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/softmmu/memory.c b/softmmu/memory.c index 4ed63f4d0d..d2797e996a 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -1915,6 +1915,7 @@ void memory_region_notify_iommu_one(IOMMUNotifier *notifier, IOMMUTLBEntry *entry) { hwaddr entry_end = entry->iova + entry->addr_mask; + IOMMUTLBEntry tmp = *entry; /* * Skip the notification if the notification does not overlap @@ -1924,10 +1925,18 @@ void memory_region_notify_iommu_one(IOMMUNotifier *notifier, return; } - assert(entry->iova >= notifier->start && entry_end <= notifier->end); + if (notifier->notifier_flags & IOMMU_NOTIFIER_DEVIOTLB) { + /* Crop (iova, addr_mask) to range */ + tmp.iova = MAX(tmp.iova, notifier->start); + tmp.addr_mask = MIN(entry_end, notifier->end) - tmp.iova; + /* Confirm no underflow */ + assert(MIN(entry_end, notifier->end) >= tmp.iova); + } else { + assert(entry->iova >= notifier->start && entry_end <= notifier->end); + } if (memory_region_notify(notifier, entry)) { - notifier->notify(notifier, entry); + notifier->notify(notifier, &tmp); } }