From patchwork Wed Feb 8 00:07:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 651526 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp3190192pva; Tue, 7 Feb 2023 16:08:57 -0800 (PST) X-Google-Smtp-Source: AK7set9So/Ia0Vbvm6vnhARiK0pLqJTEdIroCjYKjHDuC3uOwo+E1h1leSIS0JKAnqPDNjdbTdIM X-Received: by 2002:a05:622a:508:b0:3b8:6075:5d16 with SMTP id l8-20020a05622a050800b003b860755d16mr9580318qtx.56.1675814936800; Tue, 07 Feb 2023 16:08:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675814936; cv=none; d=google.com; s=arc-20160816; b=sBeZeL8g7mNRmmGECL68Ek41dPA36CFMhdYhoHmpzBJxlJ/yaCnZWzIbLfY3qggEG7 N6XPKXZTJ4YhPtcgdgyEjv2j3Vaq6/B0NobyJ7zm0VtfEKPjO0q6EF+VDNtz4+6i9klc pUrou5cbJj9hbi9nHfVXWbozFrdKZ4qaWjiOJGuHtID9HB5bAdWgcpQmQdcCXyPnL8hP INNyWY9P3T6MdPuFyRPygqB4xvIMCHLfUWoyscHJLcH7fcpHP+6QbsVgpWVkGTZv0wyD UCBROQdDh5YX6bXlZQG7QVwcaJKPvkVYez3irthZM68miwH0Pzs5pzQU/4yUeXOeJgRj x2mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=pB5gfdAId6nFf1U+98M6HgWFc/GSRqkkNeSxZeV/xDE=; b=szgXyspSUn7G/UytsKlO1+Ok5y1qPl7uPTh7/V18JH6lhX71nOsozfChNGX/dBlxVE 11kMtev5ricFUJFI4Zmgl0snktyMR3do36x6Sw60ZJTJMHt3woNdW1x1Fli2V4G2c8Lo u5K47R831S9oVV6w4+hqOlPF2asIxXFN099k/Fo+9RXVgfBTStMOif0kdEj/61TOjY86 EkpmhmeYsxrrXqNACKFG7Yv5pnHPlLhcA7ooxcxEdjJndb0UBaZ5rA4yHb3hjqkT2cm0 nSFuIx0gHqCFeLsQ1yC3HIMSaRlapKL8uZQo55g3X/HqhQhnIxZkAl9nsXihJWBLgLfm gpaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AnSeJIIO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c19-20020ac85a93000000b003a7e873fabfsi11058709qtc.119.2023.02.07.16.08.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Feb 2023 16:08:56 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AnSeJIIO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPY07-0005QJ-QB; Tue, 07 Feb 2023 19:07:51 -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 1pPY05-0005Pz-S6 for qemu-devel@nongnu.org; Tue, 07 Feb 2023 19:07:49 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pPY04-0008R9-5a for qemu-devel@nongnu.org; Tue, 07 Feb 2023 19:07:49 -0500 Received: by mail-wr1-x432.google.com with SMTP id r2so15185039wrv.7 for ; Tue, 07 Feb 2023 16:07:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pB5gfdAId6nFf1U+98M6HgWFc/GSRqkkNeSxZeV/xDE=; b=AnSeJIIOv0Xn08tuUG+OJAdaz2a9GORr3h5bdBIFwcVU4f0jRt1dAYW07THLS8LxBY jzl1Dstp4/6fXSckQRaxN5aZkUzdngRwxAFLaidHH4jYTlNVBBrO0DJu6f4yyMXoVGDB 095RpvNjadwQtdy5eMvjFrwdQSVloC6qCZhmxuVM70YHwGWjmVG3fQchjHbNGjg0jXl4 uwOao2xQXaM5g1hPZ6GcMc4y0kWaMUcYxA94zZxOeBh5ZloDP+c6m+lswgBBFH5t9RLL AidnOo0LTuKoQGypE3iGSeqciUTN+vtF8VaGFZNlxo215lm3mGSlZ0EkjtUAPlWstLaN Y3cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pB5gfdAId6nFf1U+98M6HgWFc/GSRqkkNeSxZeV/xDE=; b=6EKG1PYIpFw9z21TvUtJNtdtB3eoSbKy91P34zKvm6VmZG5yOsA1MprQorRXa/23Y0 nNqM8hEK/W71aQTI1j62C5q448u8oXHjFz1zJB4eK8eDLuXPcoXNsKUsnnE0jDkvCDBM b2tSPRqqStPuTk4BixN4c7hIlXVJsVwjJZpLmX1ooQ2GL5pQv3ULS4SK8S4udX93U8M6 xyCF2D72x8Npet0nuiQo1b0RDO24w3Mk5HySoPG+VjJ7dz7tyjzPmC12unFYVxyweHiv M5FQCO5CfSFbJsuBikCpWrB5KSycmZV019QPgXf0u4fwLZ3QhGHEZ2aJdYXrhcVOzCGE acXA== X-Gm-Message-State: AO0yUKUDdvINkbwvV1tKYwESi9yFJgqI3msHltNGPv6/Zt5wiuccyBIM QdLPqmxZGUq2e6pkyuXObaXZe/WfhH1aXqQg X-Received: by 2002:a5d:6843:0:b0:2bf:bb22:946e with SMTP id o3-20020a5d6843000000b002bfbb22946emr4786706wrw.5.1675814866155; Tue, 07 Feb 2023 16:07:46 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id h12-20020adff4cc000000b002c3d814cc63sm11414603wrp.76.2023.02.07.16.07.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 07 Feb 2023 16:07:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , qemu-block@nongnu.org, Bernhard Beschow , Mark Cave-Ayland , John Snow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 0/7] hw/ide: Untangle ISA/PCI abuses of ide_init_ioport() Date: Wed, 8 Feb 2023 01:07:36 +0100 Message-Id: <20230208000743.79415-1-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Background thread: https://lore.kernel.org/qemu-devel/5095dffc-309b-6c72-d255-8cdaa6fd3d52@ilande.co.uk/ The ide_init_ioport() method expect an ISA device, but is massaged to accept NULL device (IOW, non-ISA devices...). A plausible explanation is QOM objects can only inherit one parent, and ide_init_ioport() was first used with ISA children. Later it was adapted to accept PCI children in a convoluted way. The PIIX IDE function abuse it. This series rename the current ide_init_ioport() as ide_init_ioport_isa(), then add a generic ide_init_ioport() which works with PCI devices. This is required to proceed with more PIIX cleanups. Philippe Mathieu-Daudé (7): hw/isa: Un-inline isa_bus_from_device() hw/isa: Use isa_address_space_io() to reduce access on global 'isabus' hw/ide: Rename ISA specific ide_init_ioport() as ide_init_ioport_isa() hw/ide: Introduce generic ide_init_ioport() hw/ide/piix: Use generic ide_init_ioport() hw/isa: Assert isa_register_portio_list() gets non-NULL ISA device hw/ide/piix: Remove dead code in pci_piix_init_ports() hw/ide/ioport.c | 13 ++++++++++--- hw/ide/isa.c | 2 +- hw/ide/piix.c | 21 ++++++--------------- hw/isa/isa-bus.c | 13 ++++++++++--- include/hw/ide/internal.h | 4 +++- include/hw/isa/isa.h | 5 +---- 6 files changed, 31 insertions(+), 27 deletions(-)