From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ua1-f97.google.com (mail-ua1-f97.google.com [209.85.222.97]) (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 85F5E33506C for ; Fri, 20 Mar 2026 20:33:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.97 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774038825; cv=none; b=Y9suK749ONtkpkbJBuexJKLqBxhUXql22nhDJSFEGpHuvng0QznMBcMD5cYaNaWfJwZtdjpodGWrFCNchqhuAxbasiawjXBt5QmJejyqbHNskTzEojriznZE50RfzTdDxCWwe4CU5aZflGhfTnIpMnMj/DqWzBItoZdbOLVoV3o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774038825; c=relaxed/simple; bh=wS979EO0vwJHg6vU7g42rIzDKmM4W1oixNntOxmLr5U=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=g5l9i0p48msY259CkVm52Fu0mZCxN6wpfuaKH6HJ0GEv2VS49wU79TWZy6ldk8idkvuPqB0HAkQYO7boDXP+ILVdeEk+KPcwxNJxBDvyajdsi7XDNHaREd280UOOyMgVt+DSytOaT63IaOJg+ugbLcoN2vl37w5lntlog2riVXc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=Nv0hy+wC; arc=none smtp.client-ip=209.85.222.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Nv0hy+wC" Received: by mail-ua1-f97.google.com with SMTP id a1e0cc1a2514c-94b07fddecbso582989241.1 for ; Fri, 20 Mar 2026 13:33:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774038822; x=1774643622; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=87xjxVKGisyDqJa6XXx558fMYLadgP7GMHUKjcy6ZyQ=; b=DJ47NLOS6E5toCQ/HDAr5+zlo0fH/tXoHkOxulyP92zDCF0Dr/TX8RbKZzZzWZTqUy Huj+Z8clOUwWz3e9X8UIt+iPE9Sre6x8VwokfpjdAuK9Ez/5kS9TxVMpwSSCgQlBZbcL 9ikkIvYYzJvVvOLLfpMu55hApR85acslpbLqM62jYaZmqo6vZRyYMA2TZ/MD+CYLxMuT l0Jm/VBSv1uPTD8imEyG6NYlS8tF1t9I3zCZqQYmMRd+BEbFUQZwErA4diTRXBUC++TA 6h1lPOksqpe5qqPKQEwwuo+qa0kqidBCP4i2rxBUHUzveMuwCdbQsqEbKRm+VCy/cH6f qG3Q== X-Forwarded-Encrypted: i=1; AJvYcCVu3cH/LRmR4fC8SwluHFAwOjNxJPEdlr1yuWb9/U3+EvfBa63P05uzbiAUoSdGAlxy5A5DDfvysMCSsV8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz/bUn4KEbrHGjc2jihGjlzmDmHN0WUyYG+oJ2Y5NGZqZYVkxXT HROWLMwze5+eoR67WTYq9hcAOLijH9Gxm25/Fxu22+2ZoKB3YEc4hZrYE06zZ+taope/aMfPjgE S2bVHxtxJwp2io9qx/NtRuGsx8NOVl1K5VK++YJFWvVPd7hK++VxsBq9yxsN1qZRyQi30nlB3iX JKnVw7wBmqz3nK7SWT4vKs6dn14tsTVCPrVQDxcxWh4GDGvk8abbhL2VVQuC162zV9mFzQ5mTtJ VDAIWoCiJ9ZTfdz X-Gm-Gg: ATEYQzxWRs4CFlSmON4ayvsajwVgiPsvEeybd5ejv02f8KWbOXKQaOtNcZfu6V7hN/a ObdCG2Fea9m8zKTyMEGnnYB5cykVNnagRLbX0GHDhsTDNOm+MHYlOWmtmUv03G67JcHjC+/h4bZ iDVhJPCS+OHEHiTNQFPeiSsdMWTfRa42HhchXOt/inzlYhpewWFPVisUe76IPaiKOAMXsZNgclF w725iUtIlkIIYOjRKbkIjpbxC3DcsZOFEeDtMFbMaqi75PeHjURvYxqlgtUr2sK9pOr+yUrB2g/ Rqb07Zf82nUFrNgRXW6Euj9m8ak8HYQTgmTSPC0In2E4tfeN7kchV/yuT5P5YZtvOGAz3s+bZcJ /g+dhp9QOF4h/azKPDHLZ3da1W3TLMU+WLKX3xGYQxgjIj03Ae+Jw0uQXrcvTwyjEAmRngdK/aO 7sgf/LVEOYxmhnZZ5dPdqlMNnsmVCuGqsV6b+bn794ywRziSXHtfGolkGx X-Received: by 2002:a05:6102:f11:b0:5f5:2539:9b11 with SMTP id ada2fe7eead31-602aeb37569mr2511739137.14.1774038822447; Fri, 20 Mar 2026 13:33:42 -0700 (PDT) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-117.dlp.protect.broadcom.com. [144.49.247.117]) by smtp-relay.gmail.com with ESMTPS id ada2fe7eead31-602afc02659sm406626137.4.2026.03.20.13.33.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Mar 2026 13:33:42 -0700 (PDT) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-50937cf66b5so135728551cf.3 for ; Fri, 20 Mar 2026 13:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1774038822; x=1774643622; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=87xjxVKGisyDqJa6XXx558fMYLadgP7GMHUKjcy6ZyQ=; b=Nv0hy+wCBEJN7fgxiY3GwWlKU/W918qBJjRjoO4LdXSxTwwzb1qsUxschM4gP3/OMN 6Abi4E7FZFLjTKgOdRl2Vmb4eqE8Yfv5Bi2GlvtJP0LmniwOhzRI7f+T3b4qg6Ina6Pc u29PxLLNoeWsLTH3JvvuWSoOWLOEe2tsp5TCc= X-Forwarded-Encrypted: i=1; AJvYcCUBVH7bfuikFIid9pFi+kFwzjkhYJiqtEksPLX05hBBA6qLpUFRj+IebIyW0L7MPecnUamxeVbEtdmPN6Q=@vger.kernel.org X-Received: by 2002:a05:620a:460b:b0:8cd:9863:331f with SMTP id af79cd13be357-8cfc7a79f50mr675887285a.0.1774038821776; Fri, 20 Mar 2026 13:33:41 -0700 (PDT) X-Received: by 2002:a05:620a:460b:b0:8cd:9863:331f with SMTP id af79cd13be357-8cfc7a79f50mr675882085a.0.1774038821148; Fri, 20 Mar 2026 13:33:41 -0700 (PDT) Received: from mail.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8cfc8fb9c10sm280699985a.19.2026.03.20.13.33.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2026 13:33:40 -0700 (PDT) From: Kamal Dasu To: Ulf Hansson , Adrian Hunter , Kees Cook Cc: Tony Luck , "Guilherme G . Piccoli" , Florian Fainelli , Arend van Spriel , William Zhang , bcm-kernel-feedback-list@broadcom.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Kamal Dasu Subject: [PATCH v4 0/4] mmc: Add pstore backend for crash dump storage on eMMC Date: Fri, 20 Mar 2026 16:32:45 -0400 Message-Id: <20260320203249.1965044-1-kamal.dasu@broadcom.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=[UTF-8] Content-Transfer-Encoding: 8bit X-DetectorID-Processed: b00c1d49-9d2e-4205-b15f-d015386d3d5e This series adds mmcpstore, a pstore backend driver that enables persistent storage of kernel crash logs on eMMC devices. When the kernel panics, pstore captures the kmsg dump and writes it directly to a dedicated MMC partition using polled I/O with interrupts disabled. Changes since v3: - Fixed kernel-doc warnings reported by kernel test robot: - Added missing @param descriptions for sdhci_panic_prepare(), sdhci_panic_poll_completion(), sdhci_panic_complete() (patch 2) - Added missing @sect_offset param doc for mmcpstore_do_request_internal() (patch 4) - Fixed kernel-doc function name mismatch: mmcpstore_read() -> mmcpstore_read_zone() (patch 4) - Added missing @disk param doc for mmcpstore_card_add() (patch 4) - Removed unused 'offset_bytes' variable in mmcpstore_register_for_card() (patch 4) Changes since v2 (RFC): - Rebased onto v7.0-rc — no longer reverts any existing MMC core or SDHCI changes (v1/v2 accidentally reverted recent upstream commits due to being based on an older tree) - Removed all erase/bitmap tracking logic — MMC/eMMC is managed flash and does not need erase-before-write; the pstore_zone framework handles zone management internally - Uses standard MMC core request path (mmc_start_request) instead of hand-building mmc_request structs; panic-context I/O is handled through proper mmc_host_ops callbacks rather than ad-hoc code in the driver - Added panic-context ops to mmc_host_ops and sdhci_ops for clean separation of panic and normal I/O paths - Fixed deadlocks caused by spinlock contention during panic (lockless mmc_panic_claim_host using WRITE_ONCE) - Fixed data corruption in pstore recovery (zlib_inflate failures) by letting the normal sdhci_request() path run instead of a custom panic request handler - Added PM suspend/resume support with eMMC re-initialization - Supports module loading or builtin loading of the driver - Added MAINTAINERS entry - Split into 4-patch series for reviewability The series is structured as follows: Patch 1 adds panic-context operations to struct mmc_host_ops and a lockless mmc_panic_claim_host() for use during kernel panic when other CPUs are stopped and may hold locks. Patch 2 implements these panic-context operations in the SDHCI host controller driver: draining in-flight requests, polling for completion, and making the command retry path panic-safe. Patch 3 adds mmc_blk_get_card_by_name() helper to look up an mmc_card from a block device name, used by the mmcpstore module path for card discovery. Patch 4 adds the mmcpstore driver itself, which registers with the pstore_blk framework and handles panic writes, PM suspend/resume, and dual-path registration (direct probe hook for builtin, mmc_blk_get_card_by_name() for module). Also adds probe/remove hooks in block.c and declarations in block.h for the builtin path. Tested on Broadcom STB platforms (ARM64) with SDHCI controllers, verified panic dump recovery across multiple panic/reboot cycles with kmsg, pmsg, and console pstore. Previous submissions and related work: RFC v1: https://lore.kernel.org/linux-mmc/20221216212738.7928-1-kdasu.kdev@gmail.com/ RFC v2: https://lore.kernel.org/linux-mmc/20221222185948.12717-1-kdasu.kdev@gmail.com/ v3: https://lore.kernel.org/linux-mmc/20260319185705.1516950-1-kamal.dasu@broadcom.com/ Marvell MMC pstore attempt (2020): https://lore.kernel.org/linux-mmc/20201207115753.21728-1-bbudiredla@marvell.com/ pstore/blk documentation: https://www.kernel.org/doc/html/latest/admin-guide/pstore-blk.html Kamal Dasu (4): mmc: core: Add panic-context host operations for pstore backends mmc: sdhci: Implement panic-context write support mmc: block: Add helper to look up mmc_card by device name mmc: core: Add MMC pstore backend driver MAINTAINERS | 6 + drivers/mmc/core/Kconfig | 12 + drivers/mmc/core/Makefile | 1 + drivers/mmc/core/block.c | 56 ++ drivers/mmc/core/block.h | 18 + drivers/mmc/core/core.c | 23 + drivers/mmc/core/mmcpstore.c | 1519 ++++++++++++++++++++++++++++++++++ drivers/mmc/host/sdhci.c | 169 +++- drivers/mmc/host/sdhci.h | 6 + include/linux/mmc/host.h | 12 + 10 files changed, 1818 insertions(+), 4 deletions(-) create mode 100644 drivers/mmc/core/mmcpstore.c -- 2.34.1