From nobody Tue Feb 10 03:40:23 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1587472085; cv=none; d=zohomail.com; s=zohoarc; b=CC9FZms/Er4eQWBa3REsR0xvnQqDdEHToOgDHyMHIUYWMnGuJm5URIm5qdigUJ3bKNW6W7hc44J4tkDsOmeXFwtwwDRczbR8NtQAncJ0rRMeXSPra2KkjZV7EeGg/kdaPw66tmkN4M3/cyhH/rDBmsmc/gbysRofqKm84DUb6xI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587472085; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zOrL0Bw2XAb9sksyQa2AaC8LCpCTMRMx/mgWehci6Rg=; b=nBpqav2WjVclPCZaMFig868fGTV8Vir9N9FE9vGHgnpvC6mHUXWRECo8xo3PgthmtHsJqEylB9viwnZA6//11iUdkZz/awmiuqgm4/7G7ILtSAR84bfmrBiwWxlWmg7hL5SlVKCdmkWoA2/0bscvlCVzcEs8TyGUEzlVbNuI72Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587472085321527.3287284868557; Tue, 21 Apr 2020 05:28:05 -0700 (PDT) Received: from localhost ([::1]:57072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQs0S-0005qh-11 for importer@patchew.org; Tue, 21 Apr 2020 08:28:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59362) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQrpo-0005l8-AY for qemu-devel@nongnu.org; Tue, 21 Apr 2020 08:17:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQrpm-0006x3-JA for qemu-devel@nongnu.org; Tue, 21 Apr 2020 08:17:03 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:36235) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jQrpl-0006pL-3X; Tue, 21 Apr 2020 08:17:01 -0400 Received: by mail-wm1-x342.google.com with SMTP id u127so3433073wmg.1; Tue, 21 Apr 2020 05:16:59 -0700 (PDT) Received: from x1w.redhat.com (116.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.116]) by smtp.gmail.com with ESMTPSA id z76sm3761140wmc.9.2020.04.21.05.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 05:16:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zOrL0Bw2XAb9sksyQa2AaC8LCpCTMRMx/mgWehci6Rg=; b=qvMWhnmPkerQAXKEyBEg3wcrkLbAxN5Gm+OCD5CFWHErRv5J9TMYMyH0RmeO0r8U7G QQ8sOnefZQZ8ENHxkwTwCUSfd6YrQKTVrkfHJJMAvXt1t6nQOR2yvb/0LyK/ksTcXEVx /RaDHNvEtxeL+LmcSafDOOpZtUFNXIajcwCypfZX14Zb7Q5VTHEVRKs0M4ZMrfMok+SE tzMszs5Gkhxk1NvP8UFrLye5G66xtiLuGbuhE3YPTOwT8zKHJLi21G2ZrvpW/t1MJ3dA 8b08MhvOzdXEQiN/U6hPfw0TMwQycQXQkb08FnTTb1UI49p96Psxh0KhNxmul7iU/OTn mQbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=zOrL0Bw2XAb9sksyQa2AaC8LCpCTMRMx/mgWehci6Rg=; b=aFy2zNVAGdBdG0azm2ssoXUgy2T1fhfPQ5aCOSMfgf9JPqAO6BAhBqM3wQ0JVonTMo V01zI6HSQUuX5G6ZJmhN0FrpGLPbWGbEF1X0ctiu1FKrVsndEKwXo6Vxw+XoqUzmJpMa OKdU6iBbQ9pTYfAFuE3EV3k1YR8/HkKiFH7HA61R5HFGuzKia1e6C4TimYfYhISx9Abj UVqoDhChFUIpmxjkIJ3ln1DCFETVoFKWIWAihV14ZOK/beboXIDfmxOa9WnFxBbY1oZY GRoRL3r/XYNeqIrKuC3sa4UFgBbyiFTG3DnOnPErFFWbsZVuuZwIp3etD89kCpBRSWwj 5eGw== X-Gm-Message-State: AGi0PuZs5l+RZE6CI/EBex6YCG3a9FoHXGJZuWzL6MC8Ws9Cv64kEQIz 8/b8CIRbq3tPEohJw5/fCAZZaT0fVIk= X-Google-Smtp-Source: APiQypIYPDgFFpBFbwESXHwQ6Kj5g/rORzJTF60JCbZ+SPujuhkgh5XcYcVJIhSZF/Fa54CYeUTeKQ== X-Received: by 2002:a1c:3986:: with SMTP id g128mr4586515wma.8.1587471417858; Tue, 21 Apr 2020 05:16:57 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 15/17] hw/ide/qdev: Implement the 'temperature-sensor' qdev interface Date: Tue, 21 Apr 2020 14:16:24 +0200 Message-Id: <20200421121626.23791-16-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200421121626.23791-1-f4bug@amsat.org> References: <20200421121626.23791-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::342; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::342 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: Laurent Vivier , Peter Maydell , Thomas Huth , qemu-block@nongnu.org, qemu-trivial@nongnu.org, Michael Tokarev , Markus Armbruster , Andrew Baumann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Paolo Bonzini , Jean-Christophe Dubois , John Snow , "Dr. David Alan Gilbert" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) IDE drives exposing a SMART interface report the air flow temperature. Let them implement the 'temperature-sensor' interface. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/ide/qdev.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index c22afdb8ee..144d6ab533 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -32,6 +32,7 @@ #include "sysemu/sysemu.h" #include "sysemu/runstate.h" #include "qapi/visitor.h" +#include "hw/misc/temp-sensor.h" =20 /* --------------------------------- */ =20 @@ -270,6 +271,12 @@ static void ide_dev_instance_init(Object *obj) object_property_set_int(obj, -1, "bootindex", NULL); } =20 +static float ide_hd_get_temp(TempSensor *obj, unsigned sensor_id) +{ + /* See airflow-temperature-celsius in smart_attributes[] */ + return 100.f - 0x45; +} + static void ide_hd_realize(IDEDevice *dev, Error **errp) { ide_dev_initfn(dev, IDE_HD, errp); @@ -315,11 +322,14 @@ static void ide_hd_class_init(ObjectClass *klass, voi= d *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); IDEDeviceClass *k =3D IDE_DEVICE_CLASS(klass); + TempSensorClass *tc =3D TEMPSENSOR_INTERFACE_CLASS(klass); =20 k->realize =3D ide_hd_realize; dc->fw_name =3D "drive"; dc->desc =3D "virtual IDE disk"; device_class_set_props(dc, ide_hd_properties); + tc->sensor_count =3D 1; + tc->get_temperature =3D ide_hd_get_temp; } =20 static const TypeInfo ide_hd_info =3D { @@ -327,6 +337,10 @@ static const TypeInfo ide_hd_info =3D { .parent =3D TYPE_IDE_DEVICE, .instance_size =3D sizeof(IDEDrive), .class_init =3D ide_hd_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_TEMPSENSOR_INTERFACE }, + { } + }, }; =20 static Property ide_cd_properties[] =3D { --=20 2.21.1