Hi,

This series fixes existing gma500 dumb-buffer, GEM and SGX page-table bugs
against Linux 7.4-rc2, 7475ea8b58616b33c04afb976cf0fbaad9dd63fb. It keeps
SGX535 support and the current driver selection. The series contains no
architectural migration, new rendering interface or accelerated admission.

The existing DRM ioctl already checks width * cpp * height. The dumb-buffer
fix covers the product after 64-byte pitch alignment on 32-bit size_t.
The unpin fix uses drm_WARN_ON() and retains reservation-lock cleanup.
The cache fixes separately address a directory-entry flush after unmap
and the unconditional clflush_count division. The former is exposed by
32-bit HIGHMEM with CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP.

Following Joseph Telaak's review of the previous six-patch RFC, the MMU
changes are split into zero-page semantics, the incorrect stolen-range
unload address, removal of absent mappings, range validation, and a
transactional insertion/error-cleanup unit. The old inner do/while loops
executed once for zero-page requests; they become no-ops here.

One deliberate exception to splitting every lock change is patch 9. The
write semaphore, prefix rollback and newly introduced GEM page-release
error paths form a single safety unit. A rollback prefix cannot remain
owned while another writer is allowed to change the range. Keeping these
changes together prevents selecting an error-propagation-only patch that
frees pages while stale PTEs reference them. The temporary host fault test
explicitly checks for PTE references before each put_pages call; removing
rollback triggers that assertion.

For backports, take that entire transaction and its range-validation
prerequisite (patch 8). Do not separate err_put_pages or weaken writer
exclusion. A textual git-apply result alone does not establish safe
backporting. Fixes tags were checked against the original introducing
source: 8c8f1c958ab5 for MMU/cache behavior and ae012bdc5799 for the stolen
mapping and unchecked callers. The unload fix uses the load address,
gatt_start, rather than mmu_gatt_start (0xe0000000).

Current validation:
  - Native, UBSan and i386 CPU harnesses: ten MMU cases / 50 assertions,
    twelve extra fault/cache checks, 48 GEM checks and eleven fixture
    allocation budgets passed. Kernel services in these harnesses are
    simulated; no device or GPU is involved.
  - Actual original sizing arithmetic / DRM alignment-helper boundary
    witness passed on native, UBSan and i386 CPU backends.
  - i386 W=1 / HIGHMEM4G / forced-local-map gma500 objects compiled.
  - Normal x86_64 W=1 gma500 driver objects/archive compiled successfully.
  - Full i386 W=1 / HIGHMEM4G / forced-local-map guest-kernel link passed.
  - The actual guest kernel passed all ten software MMU KUnit cases under
    QEMU TCG; guest exit0 and parser exit0. This is software emulation,
    without a physical SGX/device or hardware cache/TLB validation.
  - Patch-prefix replay and source whitespace checks passed. Checkpatch
    has zero errors; the new KUnit file gets the generic MAINTAINERS
    advisory and is covered by the existing gma500 directory entry.

Hardware display, GPU, suspend/resume and platform validation have not
been run for this candidate. No upstream-readiness or
hardware-validation claim is made.

Patch list:
  1. Use the common dumb-buffer size helper.
  2. Prevent GEM unpin underflow with a device warning.
  3. Flush the directory entry within its local mapping lifetime.
  4. Calculate CLFLUSH count only on the path that uses it.
  5. Make zero-page MMU requests no-ops.
  6. Remove the stolen mapping at its load address.
  7. Skip absent mappings during removal.
  8. Validate MMU ranges and exclusive endpoints.
  9. Make failed MMU insertion safe for GEM error cleanup.
 10. Add software-only KUnit coverage.

Thanks,
Gabriel Gama

Reply via email to