From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C09F2F4A14 for ; Thu, 27 Nov 2025 17:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764265978; cv=none; b=LwiGmi/9AYEDrrs1yt7r9KGsCjHdr2ey0yZmq5pyqu5TCHPgzQurqrxkGFTGRJXCYm2qJqCSqoPC+4hcX5Zm8AQ8Q0MoReI/0Quvy8sawopOgl3sOz0axufzB/BiS75Phjloq/U3koj7wMvzt3ypPXcVYVwcgqh6IvkxcPx7m5s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764265978; c=relaxed/simple; bh=zSAzhxwKuOta44JAOqWeLuW5CqdcnEC8ogrwgyA9084=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XY4jty1R1r5fXvabuhDch/VwCVsEROCKhOhOlEIt2wtw009jgy5geC0AWVC1bsMHvxWd74un+fv+NHdtoGHLCdg8ABBYol+2kbbtZlIdSbwpbJUGZ/lkGzuU3yZstQyAD9KDZUgSSSGCzJnmlyPl0MF1PIiwC58ySeMyYKENXNc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fVefzQQ3; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fVefzQQ3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764265975; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=gtPSjnUmzSwYiSrQr+joxV59KEuqRkRL3KJgwUBvLQo=; b=fVefzQQ3Dfx1R4pS0FfGj4uDPuKJvRl8oin82yTefYmWLTnfS3zpM+BJ8dRwhMmn2sdbSy 5dXUFb/LQSI2rMFxBYHAaFDPVlWNJ8V//0CE9yaBm4b+FO2pgzC9YHbJuEMboojycXWA3W 23a2T6E1UV0qNKZJ7si29zMx0CzpcHg= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-331-y4vV7A-QNHy4pxdj6nGCAQ-1; Thu, 27 Nov 2025 12:52:51 -0500 X-MC-Unique: y4vV7A-QNHy4pxdj6nGCAQ-1 X-Mimecast-MFC-AGG-ID: y4vV7A-QNHy4pxdj6nGCAQ_1764265971 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F06841800250; Thu, 27 Nov 2025 17:52:50 +0000 (UTC) Received: from thinkpad-p1.kanata.rendec.net (unknown [10.22.88.119]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C1E7819560B0; Thu, 27 Nov 2025 17:52:49 +0000 (UTC) From: Radu Rendec To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Brian Masney , Eric Chanudet Subject: [PATCH RESEND v2 0/1] irqchip test driver/sandbox Date: Thu, 27 Nov 2025 12:52:24 -0500 Message-ID: <20251127175225.1110889-1-rrendec@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 This is a dummy irqchip driver that implements three different types of IRQ chips, requests interrupts like a real device driver would do, and provides the ability to manually trigger any of these interrupts. The main reason why I wrote it was to be able to hack on the kernel IRQ core without depending on any hardware (even virtual, inside a VM). But it can also be used as an example for implementing irqchip drivers. The irqchip setup/layout is described in detail in a comment block at the top of the driver's source file, so I'm not repeating it here. Two "leaf" IRQ domains are implemented: hierarchical and multiplexing. These are attached to an additional "root" domain, which is similar to APIC (x86_64) or GIC (arm64). Interrupts are simulated by calling the generic interrupt handling function on the "root" domain, in a workqueue context and with local interrupts disabled. A few notes on the implementation: - The driver cannot be compiled as a loadable module, and the only reason is because it uses irq_move_irq(), which is not exported. I could not find a better way to make IRQ affinity control for the "root" domain work on x86. This is also documented in the source code. - The driver uses a write-only module parameter with a custom handler as the interface to trigger simulated interrupts. While this slightly abuses the module parameter API, it's very simple to implement and also keeps the sysfs file confined in the module's own "namespace" at /sys/module/irqc_test. Of course, setting the parameter on the kernel command line makes no sense but doesn't have any side effect either. Signed-off-by: Radu Rendec --- Changes in v2: - Fix sysfs file mode on module parameter - Add "depends" to Kconfig to prevent build failures on unsupported architectures (no IRQ domain hierarchy support e.g. x86_32) - Link to v1: https://lore.kernel.org/all/20250923232905.1510547-1-rrendec@redhat.com/ --- Radu Rendec (1): samples: Add irqchip test driver samples/Kconfig | 11 + samples/Makefile | 1 + samples/irqchip/Makefile | 1 + samples/irqchip/irqc_test.c | 576 ++++++++++++++++++++++++++++++++++++ 4 files changed, 589 insertions(+) create mode 100644 samples/irqchip/Makefile create mode 100644 samples/irqchip/irqc_test.c -- 2.51.1