From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f74.google.com (mail-ej1-f74.google.com [209.85.218.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 470937E0FF for ; Fri, 10 Jul 2026 13:45:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783691128; cv=none; b=D/v34jmci1WtS+pG6/+gbVlXG6ral1DsZoloE+s5Y6ZHrMJf/pEMBxfJStPjFpIs3yWX/xFhoE5XXi1EPCtoTIXpeHTTnNZjZ4BTaX2a19JpbCgCXQzaEaZmHe/fOR8/Ql2hPK/xJ8rMdYcGlj7RJhbzpJbvLR6N0Q1ncrzPLNQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783691128; c=relaxed/simple; bh=5/QXF8YMjirttucuh5zBWmxlQzCXMd2P6nTZj1Q9mvU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=YoT0tL6maHJi/NfOUnh9HENaA6InoTyFaeBNk4gNo9LcGKCe32h5+/6yLMw4Bgg8KDfY3KgPQrByPwEQ27HSfZOXYli8tSv+mrqnZrud4FXcirzqUH4W2VDJn80tI82dIQOyrxvelU5O6xC1amCPfuJ9mTgh5iIPSjAf/cGMbH0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=gD+9ultn; arc=none smtp.client-ip=209.85.218.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gD+9ultn" Received: by mail-ej1-f74.google.com with SMTP id a640c23a62f3a-c15dfd34e4cso81566866b.0 for ; Fri, 10 Jul 2026 06:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783691125; x=1784295925; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=wG6HuNoWW7IygZyBT7H+i3l/PRkL2cEL2O38DxA5QNs=; b=gD+9ultn8HXWKUemnRIg/F41HtNFdhw8JM64Ht4KPmzjqZ5kxXIBwc86KmFxhvx/tr 1i//uZeZH+5Yvq5rbkhmMHnh9gHyaYjypaxWhgdD8tD5bd0Sdh/lNU1Npr8rhiuEaig5 gkSIfGORIKEQczkY4eDYaHFvz1ub4mY6FFs/oYfKSEpV0QTfQIytNIp7GafU3cBjz1Qe kw41mIF+ZUpATownkSCFxc2IIgWicbe3v1Mf6LZdTaCFi7XJ56kJaS3HofaMiu3iE5lg 0y1Y99P/4KS/QE981ivwo9xrRlRl5E9jS6m2Ec5hKpyMYpkOnuNndLMHuQQIu7V0kH+W otdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783691125; x=1784295925; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=wG6HuNoWW7IygZyBT7H+i3l/PRkL2cEL2O38DxA5QNs=; b=UBMPQ2M16hWiR0CYp9+dAD36s4UuUI4VYpxkg6qUgnDQEkAbO8t2i+4bkrp+ovk7TI AZ/RRHYrzgiJ+XU8DCBZ4z8qM7qYYJHTgVuTKX2ttC/xOAYh4zTyuQRf+AseUyfJw1aV 1vUYT7hNucWXXRh5j08i3wBYBACL7FI8vXa5P07Ny/FHBikiy+4Zv8fMX11p3V//QYam t4qsGz/BN2MNb4BZwRtYqwyMUtApCGCR36UdTIS6Zo04/9igNfcR2X22kzNA2ITyaCKq TLhgxovKjSnTUQ+kccwgP80us17FfiXzQaQ2Sah9Rtkk/NaxqDMqN4zYESF6Ko+5zlMp mqrw== X-Forwarded-Encrypted: i=1; AHgh+Rog+7/quolnIHfr6DdsfCDFf6mprg6kFW8AODDwQRV6sURSx1eISINXTbps9f3HsmtGR64nj81jrN5uKAw=@vger.kernel.org X-Gm-Message-State: AOJu0YzyMd+jRd3Q/6oPeYPEctO0f0lctTohhG13pf1wwSoll8ke19ex F/6qOWTKauXry/6TsbosRgOxRUAV0fngNufnQpHVtLzXSOtwnIGnD8L0pjDqyKBXajfbOthJOhg JtjqMKxqXqOzAXAQBdg== X-Received: from ejbri40.prod.google.com ([2002:a17:906:d7e8:b0:c15:f2a5:1700]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a17:907:1c2a:b0:c15:da6a:c27c with SMTP id a640c23a62f3a-c15da6ac90emr390710966b.25.1783691125330; Fri, 10 Jul 2026 06:45:25 -0700 (PDT) Date: Fri, 10 Jul 2026 13:45:24 +0000 In-Reply-To: <20260709-fw-boot-b4-v6-3-ca391e1a4108@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260709-fw-boot-b4-v6-0-ca391e1a4108@collabora.com> <20260709-fw-boot-b4-v6-3-ca391e1a4108@collabora.com> Message-ID: Subject: Re: [PATCH v6 3/7] drm/tyr: add Memory Management Unit (MMU) support From: Alice Ryhl To: Deborah Brouwer Cc: Daniel Almeida , Danilo Krummrich , David Airlie , Simona Vetter , Benno Lossin , Gary Guo , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, boris.brezillon@collabora.com, samitolvanen@google.com, acourbot@nvidia.com, alvin.sun@linux.dev, laura.nao@collabora.com, work@onurozkan.dev, beata.michalska@arm.com, steven.price@arm.com, lyude@redhat.com Content-Type: text/plain; charset="utf-8" On Thu, Jul 09, 2026 at 02:36:43PM -0700, Deborah Brouwer wrote: > From: Boris Brezillon > > Add Memory Management Unit (MMU) support in Tyr. The MMU module wraps a > SlotManager instance to allocate MMU address-space slots for use by > virtual memory (VM) address spaces. The MMU's SlotManager uses an > AddressSpaceManager to handle the hardware-specific callbacks. For > example, the AddressSpaceManager activates and evicts VMs from slots by > writing commands to the MMU registers. > > Add an implementation block for the MMU's MEMATTR register to provide > a method for translating the Memory Attribute Indirection Register (MAIR) > format from the pagetable configuration to a format understood by the MMU. > > Create an mmu instance during probe, it will be used by subsequent patches > in this series. > > Wrap the iomem stored in TyrDrmRegistrationData in an Arc. The iomem > is stored in the mmu through its AddressSpaceManager. In anticipation > of the iomem also being stored in the firmware object, set up shared > ownership of the iomem now. > > Update Kconfig to add the new MMU and IOMMU dependencies required > by this MMU module. > > Signed-off-by: Boris Brezillon > Co-developed-by: Deborah Brouwer > Signed-off-by: Deborah Brouwer > +//! Memory Management Unit (MMU) module. > +//! > +//! The GPU MMU provides a limited number of memory address spaces for use by command streams. > +//! The MMU translates virtual addresses to physical addresses and manages memory configuration > +//! and access permissions. > +//! > +//! This MMU module is essentially a locked wrapper around a [`SlotManager`] instance. > +//! The [`SlotManager`] manages the assignment of virtual address spaces to hardware address-space > +//! (AS) slots. MMU commands such as updates and flushes are carried out by the > +//! [`AddressSpaceManager`] which actually writes to the MMU registers. > +#![allow(dead_code)] This occurs in a few different commits, but I'd make sure to use expect(dead_code) here so we are sure to remove it when everything is used. > +/// Virtual memory (VM) address space data for use in MMU operations. > +#[pin_data] > +pub(crate) struct VmAsData<'bound> { > + /// The address space seat tracks this VM's binding to a hardware address space slot. > + /// Uses [`LockedBy`] to ensure safe concurrent access to the slot assignment state, > + /// protected by the [`AsSlotManager`] lock. > + as_seat: LockedBy>, Why not use the LockedSeat type alias here? > + let lockaddr_val = LOCKADDR::zeroed() > + .try_with_size(lockaddr_size)? > + .try_with_base(lockaddr_base)? > + .into_raw(); Should this be: let lockaddr_val = LOCKADDR::zeroed() .try_with_size(lockaddr_size)? .try_with_base(lockaddr_base >> 12)? .into_raw(); or even just let lockaddr_val = lockaddr_size | lockaddr_base; ? Alice