From nobody Sun Feb 23 11:41:38 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1740157525; cv=none; d=zohomail.com; s=zohoarc; b=mH5mpC9xzLwia9mggOsg/pvW25E82ZZdhpe0s2McjTqENZGivkbDxEnxhnfjhi74I7nDij0l83uZm8Yt4meUcH+bbV8sdSHy8fw4a0CvXLRbWbqQAWr7h9/7l0O6qbRH+avnbr+14Wb0+74qPP0+7hxmcYjTQRw/IP9Sobu5SAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740157525; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1nJY4+DKOnRdgOSJbixQgGwalcHO4gTnjYN+sbdUtTI=; b=GYK1NrGx/vWlH87gTDzzUvQOaOQomAMJ4tSFtikjS4iM6Kf7XM0nsz2UYBNV6G+Q8ZLvZjOaD+ypu0lE2k8BQjCJnxNgKjLE7QwtfOccSMfOI1jRbUHSv5qorN3Xr83qojf94zKMRsiZoT+K0Fw5q7xldYVqJ0Vmt2amnz05jZU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1740157525633507.28026689696446; Fri, 21 Feb 2025 09:05:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tlWRX-0006oA-Lv; Fri, 21 Feb 2025 12:04:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlWRP-0006gf-43 for qemu-devel@nongnu.org; Fri, 21 Feb 2025 12:03:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlWRN-0001OX-6E for qemu-devel@nongnu.org; Fri, 21 Feb 2025 12:03:54 -0500 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-253-IUY3wfD4MUKy81kSyCNTZQ-1; Fri, 21 Feb 2025 12:03:50 -0500 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-38f3eb82fceso1122071f8f.0 for ; Fri, 21 Feb 2025 09:03:50 -0800 (PST) Received: from [192.168.10.48] ([151.95.61.185]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-439b02f5b38sm22973835e9.24.2025.02.21.09.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2025 09:03:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740157432; 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: in-reply-to:in-reply-to:references:references; bh=1nJY4+DKOnRdgOSJbixQgGwalcHO4gTnjYN+sbdUtTI=; b=RlNjmN6xySA3oVcoGWhUlY34d9rNJwWK5cccg1hOnU+FAaa862hkO+Q7PJya3uuw9M/sVN tnZrUWm2mWxDk0mk7+4yzrf5GKURmrV8c7BwdNJI4gFCyy746GEcn2AaiY7xWdfilDivvp f/LzX9ivGsxsrD1FoO3J9ovFBeQX9n4= X-MC-Unique: IUY3wfD4MUKy81kSyCNTZQ-1 X-Mimecast-MFC-AGG-ID: IUY3wfD4MUKy81kSyCNTZQ_1740157430 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740157429; x=1740762229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1nJY4+DKOnRdgOSJbixQgGwalcHO4gTnjYN+sbdUtTI=; b=guAb+JSihzZsvCKv2/dK7xmFCCSBelZwjTHwU2XQg1kS3471puT3I0oTe5goXnEmCL mo2Keem2+D82BMOcfD36qxogoyT73QWCoM4/KGOpOsgaJwX/2A0BeSW/jaGgX9PiXKkG lMFwEyAepeQzONEJ1djT74YHsXpVXPavZxqoGPblCoFmTxnme1+7YfA0fqidWSSZPPLK uAmEemPeAYR0021HkvYCc0ovOdZzqI9dOFkAb3ROzQQrC45uT0cHsCZz5V06MUoDzKqE s/08U5oKyjAAcDNstUwdK1qFDfmpwZpSfrF8C4n28xPPqgmekcqEd66Uok7V741y4fcX YGwg== X-Gm-Message-State: AOJu0Yz/lzoM92ZPvB04dI5PfwJXOoUYxLftkcXUpddPOfh+Dn0D4EC+ PkBYNXwck4JWBTt5x9LaAzR3OXvaenICLOuIC3+cyxGO+D3x3rZrD0Jx52dJeu1DuyOlE7tcCHX nffeyv38g5BYcXWcF4kPme/hTY6ov7+Qu1z8MbG3KnAYGUdA994/0tEV2IV2yqjIDv8JTC+eLAO eMnLKUrFyTuI2n8QpUih7f8fuNEeF7OMnR1eZSskI= X-Gm-Gg: ASbGncs+7ZbvDQCeBjbH0T+zR2HRosHm99m+pvdaTvgaoZzcroevdEk4b1MtZ/i/UBM mCVotZ5Qv5dAEoqFwFLhEMFwIBUmub76PKMdICE0vXhooFwQHLRaqTmq6Pn1FAaaohLeo+Vt35T nMZmq1HLRIg9jQiUUiOz50wOQMQfiXc/WibyhLLhUIKCIfWeOasDPDSPMNFg0jVV8rCsE8prfBM XvbnEaEfIPHk5DOHJYkTLLJ3MJDwVDVAqiWxhrRJQhGYwd/vIoZMBAGEzuMBPjwaKaalfQygFBz zzi/EH3v6KVLgm1lFIk= X-Received: by 2002:a5d:4e87:0:b0:38d:a879:4778 with SMTP id ffacd0b85a97d-38f6f0529bbmr3684301f8f.33.1740157428526; Fri, 21 Feb 2025 09:03:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGHSCdTAjM6t/EsZj2CvLBtQmF/ZHcMG+AKfYF+Hr94UnN5YaIxc7Z5J3yJYVGY+iuVXnIRcg== X-Received: by 2002:a5d:4e87:0:b0:38d:a879:4778 with SMTP id ffacd0b85a97d-38f6f0529bbmr3684039f8f.33.1740157426446; Fri, 21 Feb 2025 09:03:46 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: qemu-rust@nongnu.org Subject: [PATCH 02/15] rust: add SysBusDeviceImpl Date: Fri, 21 Feb 2025 18:03:29 +0100 Message-ID: <20250221170342.63591-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250221170342.63591-1-pbonzini@redhat.com> References: <20250221170342.63591-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.424, 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1740157526627019100 Content-Type: text/plain; charset="utf-8" The only function, right now, is to ensure that anything with a SysBusDeviceClass class is a SysBusDevice. Signed-off-by: Paolo Bonzini --- rust/hw/char/pl011/src/device.rs | 5 ++++- rust/hw/timer/hpet/src/hpet.rs | 4 +++- rust/qemu-api/src/sysbus.rs | 8 +++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char/pl011/src/devi= ce.rs index fe73771021e..7063b60c0cc 100644 --- a/rust/hw/char/pl011/src/device.rs +++ b/rust/hw/char/pl011/src/device.rs @@ -20,7 +20,7 @@ prelude::*, qdev::{Clock, ClockEvent, DeviceImpl, DeviceState, Property, ResetType= , ResettablePhasesImpl}, qom::{ClassInitImpl, ObjectImpl, Owned, ParentField}, - sysbus::{SysBusDevice, SysBusDeviceClass}, + sysbus::{SysBusDevice, SysBusDeviceClass, SysBusDeviceImpl}, vmstate::VMStateDescription, }; =20 @@ -176,6 +176,8 @@ impl ResettablePhasesImpl for PL011State { const HOLD: Option =3D Some(Self::reset_hold); } =20 +impl SysBusDeviceImpl for PL011State {} + impl PL011Registers { pub(self) fn read(&mut self, offset: RegisterOffset) -> (bool, u32) { use RegisterOffset::*; @@ -746,3 +748,4 @@ impl ObjectImpl for PL011Luminary { =20 impl DeviceImpl for PL011Luminary {} impl ResettablePhasesImpl for PL011Luminary {} +impl SysBusDeviceImpl for PL011Luminary {} diff --git a/rust/hw/timer/hpet/src/hpet.rs b/rust/hw/timer/hpet/src/hpet.rs index 75ff5b3e8d6..b4ffccf815f 100644 --- a/rust/hw/timer/hpet/src/hpet.rs +++ b/rust/hw/timer/hpet/src/hpet.rs @@ -23,7 +23,7 @@ qdev::{DeviceImpl, DeviceMethods, DeviceState, Property, ResetType, Re= settablePhasesImpl}, qom::{ObjectImpl, ObjectType, ParentField}, qom_isa, - sysbus::SysBusDevice, + sysbus::{SysBusDevice, SysBusDeviceImpl}, timer::{Timer, CLOCK_VIRTUAL}, }; =20 @@ -887,3 +887,5 @@ fn properties() -> &'static [Property] { impl ResettablePhasesImpl for HPETState { const HOLD: Option =3D Some(Self::reset_hold); } + +impl SysBusDeviceImpl for HPETState {} diff --git a/rust/qemu-api/src/sysbus.rs b/rust/qemu-api/src/sysbus.rs index fa36e12178f..fee2e3d478f 100644 --- a/rust/qemu-api/src/sysbus.rs +++ b/rust/qemu-api/src/sysbus.rs @@ -14,7 +14,7 @@ irq::{IRQState, InterruptSource}, memory::MemoryRegion, prelude::*, - qdev::{DeviceClass, DeviceState}, + qdev::{DeviceClass, DeviceImpl, DeviceState}, qom::{ClassInitImpl, Owned}, }; =20 @@ -25,10 +25,12 @@ unsafe impl ObjectType for SysBusDevice { } qom_isa!(SysBusDevice: DeviceState, Object); =20 -// TODO: add SysBusDeviceImpl +// TODO: add virtual methods +pub trait SysBusDeviceImpl: DeviceImpl + IsA {} + impl ClassInitImpl for T where - T: ClassInitImpl, + T: SysBusDeviceImpl + ClassInitImpl, { fn class_init(sdc: &mut SysBusDeviceClass) { >::class_init(&mut sdc.parent_clas= s); --=20 2.48.1