Skip to content

Fast forward m1n1_windows fork to latest upstream base m1n1 version - #4

Merged
amarioguy merged 240 commits into
mainfrom
staging/m1n1_upstream_fast_forward_08_22_2026
Aug 22, 2026
Merged

amarioguy merged 240 commits into
mainfrom
staging/m1n1_upstream_fast_forward_08_22_2026

Conversation

@amarioguy

Copy link
Copy Markdown
Collaborator

Couple of years behind but we caught up eventually

svenpeter42 and others added 30 commits September 2, 2025 23:48
These have been converted from the downstream DTS using the following
python script:

import libfdt
import sys
import re

def get_address(dt, node_offset):
    # find parent with ranges
    parent_offset = node_offset
    ranges = None
    while parent_offset:
        try:
            ranges = dt.getprop(parent_offset, "ranges")
        except:
            pass
        if ranges:
            break
        parent_offset = dt.parent_offset(parent_offset)

    addr = dt.getprop(node_offset, "reg").as_int64_list()[0]
    for start, parent, size in zip(*[iter(ranges.as_int64_list())] * 3):
        if addr >= start and addr < start + size:
            return parent - start + addr

    return addr

def find_fuses(dtb_blob, idx, soc):
    dt = libfdt.Fdt(dtb_blob)

    phy = dt.get_alias("atcphy" + str(idx))
    if not phy:
        return
    node_offset = dt.path_offset(phy)
    nvmem = dt.getprop(node_offset, "nvmem-cells").as_int32_list()
    nvmem_names = dt.getprop(node_offset, "nvmem-cell-names").as_stringlist()

    cells = {}
    base = None
    for phandle, name in zip(nvmem, nvmem_names):
        node_offset = dt.node_offset_by_phandle(phandle)
        if base is None:
            base = dt.getprop(dt.parent_offset(node_offset), "reg").as_int64_list()[0]
            base = get_address(dt, dt.parent_offset(node_offset))
        reg = base + dt.getprop(node_offset, "reg").as_int32_list()[0]
        bits = dt.getprop(node_offset, "bits").as_int32_list()

        fuse = [
            reg,
        ] + bits
        cells[name] = fuse

    table = [
        ("cio3pll_dco_coarsebin0", "CIO3PLL_DCO_NCTRL", "CIO3PLL_DCO_COARSEBIN_EFUSE0"),
        ("cio3pll_dco_coarsebin1", "CIO3PLL_DCO_NCTRL", "CIO3PLL_DCO_COARSEBIN_EFUSE1"),
        (
            "cio3pll_dll_start_capcode",
            "CIO3PLL_FRACN_CAN",
            "CIO3PLL_DLL_CAL_START_CAPCODE",
        ),
        ("cio3pll_dtc_vreg_adjust", "CIO3PLL_DTC_VREG", "CIO3PLL_DTC_VREG_ADJUST"),
        ("aus_cmn_shm_vreg_trim", "AUS_COMMON_SHIM_BLK_VREG", "AUS_VREG_TRIM"),
        ("auspll_rodco_encap", "AUSPLL_DCO_EFUSE_SPARE", "AUSPLL_RODCO_ENCAP_EFUSE"),
        (
            "auspll_rodco_bias_adjust",
            "AUSPLL_DCO_EFUSE_SPARE",
            "AUSPLL_RODCO_BIAS_ADJUST_EFUSE",
        ),
        (
            "auspll_fracn_dll_start_capcode",
            "AUSPLL_FRACN_CAN",
            "AUSPLL_DLL_START_CAPCODE",
        ),
        ("auspll_dtc_vreg_adjust", "AUSPLL_CLKOUT_DTC_VREG", "AUSPLL_DTC_VREG_ADJUST"),
        ("aus_cmn_shm_vreg_trim", "AUS_COMMON_SHIM_BLK_VREG", "AUS_VREG_TRIM"),
    ]

    print("static const struct atc_fuse_info atc_fuses_t%d_port%d[] = {" % (soc, idx))
    for name, a, b in table:
        cell = cells[name]
        print(
            "    {"
            + hex(cell[0])
            + ", "
            + str(cell[1])
            + ", "
            + str(cell[2])
            + ", "
            + a
            + ", "
            + b
            + "},"
        )
    print("};")

if __name__ == "__main__":
    with open(sys.argv[1], "rb") as f:
        fdt = f.read()

    match = re.search(r"t(\d+)", sys.argv[1])
    soc = int(match.group(1))

    for idx in range(10):
        find_fuses(fdt, idx, soc)

Signed-off-by: Sven Peter <sven@svenpeter.dev>
After discussion with the Linux DT maintainers we agreed to not extend
lists with the generic compatibles anymore [1]. The upstream device
trees for t602x devices will be the first devices affected by this. Let
m1n1 temporarily add these generic compatibles to keep support for t602x
devices in downstream projects relying on generic compatibles.

[1]: https://lore.kernel.org/asahi/12ab93b7-1fc2-4ce0-926e-c8141cfe81bf@kernel.org/

Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
u-boot and linux should be built using specific tags but let's try this
first to avoid forgetting updating tags.
The workflow runs only on main and for pull request touching it to avoid
failures in pull requests due to u-boot and linux changes.

Signed-off-by: Janne Grunau <j@jannau.net>
ld.lld started with 21.1 using 0x200000 as image base conflicting with
the fixed address of 0x1238 for the .text section used in m1n1's asm.py.
Linking as position independent executable avoids this.

Signed-off-by: Janne Grunau <j@jannau.net>
Bumps the github-actions group with 1 update: [actions/setup-python](https://github.com/actions/setup-python).


Updates `actions/setup-python` from 5 to 6
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Janne Grunau <j@jannau.net>
Fixes: 54d2c7f ("CI: add target to build UEFI-only boot.bin")
Signed-off-by: Janne Grunau <j@jannau.net>
Only runs on tags shall be used to update the package for the uefi-only
installer target. Testing on release branches ensures that the workflow
runs before a tag is created.

Signed-off-by: Janne Grunau <j@jannau.net>
This will be used to check all compatible strings in
`adt_is_compatible()`. For now use it to implement ADTNode::compatible()
returning the n-th compatible string on rust side and the C wrapper
function adt_is_compatible_at().

Signed-off-by: Janne Grunau <j@jannau.net>
The t602x atc-phy nodes carry "[atc-phy,t6020, atc-phy,t8112]" as
compatible property. This results in trying to read t8112 fuses on those
machines which fails with SError when the adt_is_compatible() regression
is fixed.

Signed-off-by: Janne Grunau <j@jannau.net>
Fixes a regression in the ADT rust reimplementation checking only the
first compatible.

Closes: AsahiLinux#496
Fixes: 5bc1d2f ("adt: replace adt_is_compatible() with Rust")
Signed-off-by: Janne Grunau <j@jannau.net>
Simplifies referencing the root ADT node in rust code.

Signed-off-by: Janne Grunau <j@jannau.net>
Github's upload-artifact@v4 action does not add directories to the zip
archive. This is not compatible with the installer. Instead create the
installer package explicitly and upload that that as artifact.

Signed-off-by: Janne Grunau <j@jannau.net>
Do not explicitily request rustup's stable toolchain as that will not
be fully installed when it diverges from the rust install in github's CI
runner image.

Signed-off-by: Janne Grunau <j@jannau.net>
Reverse chronologically order ensures that later devices with multiple
compatibles matches their compatible first. This is applicable on t602x
devices were the atc-phy nodes have '"atc-phy,t6020", "atc-phy,t8112"'
as compatible.

Suggested-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Janne Grunau <j@jannau.net>
M3 introduces new tunables that have to be applied before the
axi2af ones anyway so let's rename what used to be called fuses
to common-a and what used to be called common to common-b.

Also add the old name for backwards compatibility

Signed-off-by: Sven Peter <sven@svenpeter.dev>
No published asahi downstream or upstream Linux kernel used this
property.

Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Janne Grunau <j@jannau.net>
The insertion of the new property may update the fdt in a way that a
pointer to fdt data becomes invalid and points to random data.

Fixes: 31a60d7 ("kboot_atc: Rename tunables")
Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Yureka <yureka@cyberchaos.dev>
Signed-off-by: Yureka <yureka@cyberchaos.dev>
Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
Signed-off-by: Alba Mendez <me@alba.sh>
…updates

Bumps the github-actions group with 2 updates in the / directory: [actions/checkout](https://github.com/actions/checkout) and [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/checkout` from 5 to 6
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v5...v6)

Updates `actions/upload-artifact` from 4 to 5
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
The macos-13 runner is unsupported since 2025-12-04
actions/runner-images#13046

Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Janne Grunau <j@jannau.net>
svenpeter42 and others added 29 commits August 1, 2026 13:56
Signed-off-by: Sven Peter <sven@svenpeter.dev>
Useful to e.g. strip clpc which causes some panic when booting with -C0

Signed-off-by: Sven Peter <sven@svenpeter.dev>
XNU at least on macOS 27 touches it all the time on every single CPU
which results in a very slow boot due to all the python round trips.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
XNU on macOS 27 has started to issue these *constantly* and we can't
afford to round trip these to the proxy.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
This is required for newer firmwares (26.x) at least on both M3 and M4.

Signed-off-by: Yureka <yureka@cyberchaos.dev>
Also upload m1n1.bin release artifacts. Rename the workflow from
"installer" to "release" to catch its purpose.

Signed-off-by: Janne Grunau <j@jannau.net>
Setting the DMA direction for commands that don't do any transfer likely
triggered the PRP NULL check for which we needed a chicken bit. That bit
has disappeared starting with macOS 15 so let's just do this correctly
instead.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
macOS always writes zero there so let's mirror that.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
Now that we set the DMA direction correctly inside the TCB we don't need
to set this chicken bit anymore.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
T8122 and T6030 ADTs miss a power-gates property in dart-isp. Turn
ISP_SYS manually on so that the tracer can use dart-isp.

Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Janne Grunau <j@jannau.net>
While macOS 14.8.3 enables the cache for all planes with a write to
offset 0x1c1c00 the per plane enable registers as used for T6031 still
work.

Signed-off-by: Janne Grunau <j@jannau.net>
T6030's mcc is identical to T8122 with 50% more planes and dcs. Only
it's TZ carveout offsets differ. Since they differ as well from T6031
rename t603x_tz_regs to t6031_tz_regs.

Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Janne Grunau <j@jannau.net>
This was always dead code as the fdt_for_each_subnode() loop to disable
phandle matches only iterates over direct children of "/soc*" nodes. The
endpoints of "port" or "ports" subnodes are never looked at.

Signed-off-by: Janne Grunau <j@jannau.net>
Avoids unintended "acio-cpu%d" matches for "acio" in
dt_disable_missing_devs().

Signed-off-by: Janne Grunau <j@jannau.net>
Required to disable missing acio devices where the DT node uses regs[2].

Signed-off-by: Janne Grunau <j@jannau.net>
Disable acio nodes and their child nodes.

Signed-off-by: Janne Grunau <j@jannau.net>
Adds new rust dependency sha1_smol.

Signed-off-by: Janne Grunau <j@jannau.net>
As seen on M5 Pro/Max (T6050)

Signed-off-by: Yureka <yureka@cyberchaos.dev>
Signed-off-by: Sasha Finkelstein <k@chaosmail.tech>
Signed-off-by: Yureka <yureka@cyberchaos.dev>
M4 and later have additional regs and use a different mmio base for
NVMMU ops. In this case, ans[3] becomes the reg for NVMMU ops while
NVME ops move to ans[9].
Additionally, write ioq_{cmd,cqe}s to nvme+0x120{0,8} as otherwise
IO cmds fail and ANS crash logs indicate the IOSQ base is 0.

Signed-off-by: Yureka <yureka@cyberchaos.dev>
Signed-off-by: Arminder Singh (amarioguy) <arminders208@outlook.com>
@amarioguy
amarioguy merged commit 47d60c2 into main Aug 22, 2026
1 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.