From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (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 7FB6742AA3 for ; Wed, 17 Dec 2025 01:58:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765936696; cv=none; b=dZhT9P7bDrHgbqkSbxGkWEXt2HDRW6R3PNJza9lYqiWBPW8rOdqmxReoBwee9K7IbCRqyCzvAG2A6DGcVgfR3syum5rhAqixt134Bg/QeuD4UBZrloFYHgYndIF328EoQ94mWHc2iC3zG/RqNMlSbcy6owP3IwMqU6QhO6Tky5o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765936696; c=relaxed/simple; bh=eJoUwpOlo3mrWCJewmLgiMZWDxd+fVoyPTjKWRXAGNc=; h=From:Content-Type:Mime-Version:Subject:Message-Id:Date:Cc:To; b=RfudWzJxwBVtGfXfyJsWlF9h3opYkDwR5Tv5R74FnCWjb6K3DUyF3VUuf0UXw4UHGOgPQE9abvaFQyLh18kgUsa47bUUyd36MySeAG51VX1XW9JFi/6FewHZQyF/eM05/Meuhk+ax+g8Tatd8oKkq4wJtkTB5g6HsuBmAEM9zOU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=RPWEfNZ3; arc=none smtp.client-ip=209.85.216.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RPWEfNZ3" Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-34ccbf37205so1287189a91.2 for ; Tue, 16 Dec 2025 17:58:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765936694; x=1766541494; darn=vger.kernel.org; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=T1vEIkK/2ybhTu1bw8gMkDSJNjwERGu+C1Ah+EoVRMw=; b=RPWEfNZ3BfTsVU0g9ZMqVp6fpvF7Vo08jer69u5qOaq7oUpx7Et3MSkxnLUiXGUC9K UUw25n4LviapkvgASs7lUvxOATse9nqXGrXs3u9y0qwI4WiwGKZm+QYRtjKMo6OozIKA 3bq1DG8q4hxro1B/wYNmvMF6boXjVFLOKtH2CjDk2jpQ/NE1IyrzoWsIAHYjhXNpkm7r fyIhQIVVHUOSe1S3Ovlh9Uo8zGxKcrLo/f0DBV8WWnmpyEyDm3CkxrSmztFzlI1YcOOE MNZ0Zq9VlTOuLn+CC+pfR1Ub2MA4AlB9bFJ3sONaO1Du7xZ1mEluMS6D9Ni81nq5PILi O/zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765936694; x=1766541494; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=T1vEIkK/2ybhTu1bw8gMkDSJNjwERGu+C1Ah+EoVRMw=; b=Cxvtxr9czGRQXCbNedG2ZGJRc7EU7mMNSW6lLRB+BylkrsXwLCHPnEG6qqVbKv+esG iPkOTC74x1EB+SPjy8wOfHxDmXjO6gHRW8RyC0J1jhnh6h4ddRMauDHVFWy17O70QFE3 P6KQEb3lBtXKNPZdqkyeHEEneO354/BbJ+pAQPMFbJmQSvfuMT3JVvxOTFLBr+yTUOYs ZpZiIYiBkN7yistV/K000yZE6A0Pa5lx57vCNQ3ktx7GRZZtNRBLV98QNk96Vb2wt38F NwhKBvZOVdiiE7m25p+sCx6ihb3mmP7JOiGdTgAUfMgicWU5NWHZ9Hium1rYdIB7ETXX VLpw== X-Gm-Message-State: AOJu0YzUJ5Qz10NJy8PEr5+H2IJHNvc4vb1a+wmScJw9NK7PubBmCmSm bpNTKYkw8yTmZqhnrR5iQEGvvXFEssz2P2RO8tzbUGcfDkUsSKhUu2MW/ajpfctx3zCEPVzA/lZ O67z9Fg== X-Gm-Gg: AY/fxX4qQdGP2vcoXnsuaq4KRo5kCpCJAN/vd5KA6evett/xqEGiWDERlyZo448k9nl Ga11V9mtON6Qbr+qzLGjtph2XLVrk+3UIq+Y8qctJDaFZfR4/VZXFVXzjbpd/H/DKGZo/wc2l9w LIYq7waiwy72Jb3M1F1e2L4KAqKy74tsP17Se0xWQb1rPwprZATxrct4g/ltW1wFit3BegBy3Wg gzmAaVH9Fm3Z2f6Wl7OgkKBqmv4Gu7UErBL8nRW+KOLWgGAGfdwHywOQI0tCjre0xPoWJqQnO7Z NktJGtRuFsaNtldYYozjaVN9RfknUPgEXN8tfqwnrwFEKWyxrwZJvSpDDCtN8YI+JUSBx2CXIWF UgveEujZVau6AL47jh+5qF27C6s15Y46/zZOOX9n1UuhaS3QNHRhhbH0/BYflZwPU1VuF9jaaPR qchqDEuBkaGQz9BdEEifN+/umDbpoeFw== X-Google-Smtp-Source: AGHT+IEbwuKiCbpuiM6VQa/JbDOAaxqHwDl1GwUiyaVa/Vuhw+vIGGvHUkXOjJMt/zqSoFm75cG8dg== X-Received: by 2002:a17:90b:3912:b0:34a:b459:bd10 with SMTP id 98e67ed59e1d1-34abd816e28mr15303951a91.24.1765936693573; Tue, 16 Dec 2025 17:58:13 -0800 (PST) Received: from smtpclient.apple ([103.163.156.9]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-34cd54a702asm982223a91.5.2025.12.16.17.58.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Dec 2025 17:58:13 -0800 (PST) From: Chao Xie Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: [irq-msi] questions about irq msi_desc usage Message-Id: Date: Wed, 17 Dec 2025 09:58:00 +0800 Cc: tglx@linutronix.de To: linux-kernel@vger.kernel.org X-Mailer: Apple Mail (2.3826.600.51.1.1) I intend to upstream a driver for a new bus, which utilizes MSI IRQ.=20 I have some questions regarding how to implement MSI IRQ support for it: 1. To define my own private data structure, should I follow the PCI MSI approach and add a structure like struct my_private_intr_desc to=20 the union?=20 struct msi_desc { ... union { struct pci_msi_desc pci; struct msi_desc_data data; +++ struct private_intr_desc private_intr; }; };=20 I think I can make use of data.docckie.ptr to point to my private = data structure, but I do not find any example in kernel, and not sure = whether It is right or not. 2. If I use data.dcookie.ptr to point to my private data structure, should this association be initialized in = msi_domain_ops.set_desc()? 3. The Type 1 interrupt of this bus is similar to MSI.=20 Specifically, its configuration space includes registers such as=20 interrupt_enable, interrupt_mask, and interrupt_data, with the = following specifications: =E2=80=A2 Interrupt Enable: The software configures this register to control whether the interrupt function of the Entity is enabled. =E2=80=A2 Interrupt Data: The software configures the start number = of interrupt vectors into this register. When the Entity reports an interrupt, it shall follow the rules below: (1) When one interrupt vector is enabled, the interrupt data reported by the Entity shall be X, where X is the value configured in the Interrupt Data register. (2) When N interrupt vectors are enabled, the interrupt data reported by the Entity shall range from X to X+N-1, and the value shall correspond to the sequence of interrupt vectors. X is the value configured in the Interrupt Data register. =E2=80=A2 Interrupt Address: The software configures the interrupt address allocated by the interrupt subsystem into this register. =E2=80=A2 Interrupt Mask: The software configures this register to control whether the interrupt reporting corresponding to the Entity is masked. Its 32 bits correspond to 32 interrupt vector numbers respectively. In this case, when allocating msi_desc, should I follow the PCI MSI model where one msi_desc represents multiple interrupts=20 (i.e.,set msi_desc.nvec_used =3D n)? If this is the correct approach,=20= is itfeasible to add a judgment similar to PCI MSI in msi_domain_get_virq() as follows: if (dev_is_pci(dev) && domid =3D=3D MSI_DEFAULT_DOMAIN) devmsi =3D to_pci_dev(dev)->msi_enabled; +++ if (dev_is_my_private(dev) && domid =3D=3D MSI_DEFAULT_DOMAIN) +++ devmsi =3D to_my_private_entity(dev)->is_type1;