mirror of
https://github.com/LuckfoxTECH/luckfox-pico.git
synced 2026-01-19 17:59:18 +01:00
project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp: Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem. sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately. sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades. sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for fastboot. Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
@@ -2596,6 +2596,18 @@ static int __s390_enable_skey_pte(pte_t *pte, unsigned long addr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Give a chance to schedule after setting a key to 256 pages.
|
||||
* We only hold the mm lock, which is a rwsem and the kvm srcu.
|
||||
* Both can sleep.
|
||||
*/
|
||||
static int __s390_enable_skey_pmd(pmd_t *pmd, unsigned long addr,
|
||||
unsigned long next, struct mm_walk *walk)
|
||||
{
|
||||
cond_resched();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __s390_enable_skey_hugetlb(pte_t *pte, unsigned long addr,
|
||||
unsigned long hmask, unsigned long next,
|
||||
struct mm_walk *walk)
|
||||
@@ -2618,12 +2630,14 @@ static int __s390_enable_skey_hugetlb(pte_t *pte, unsigned long addr,
|
||||
end = start + HPAGE_SIZE - 1;
|
||||
__storage_key_init_range(start, end);
|
||||
set_bit(PG_arch_1, &page->flags);
|
||||
cond_resched();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct mm_walk_ops enable_skey_walk_ops = {
|
||||
.hugetlb_entry = __s390_enable_skey_hugetlb,
|
||||
.pte_entry = __s390_enable_skey_pte,
|
||||
.pmd_entry = __s390_enable_skey_pmd,
|
||||
};
|
||||
|
||||
int s390_enable_skey(void)
|
||||
@@ -2707,3 +2721,89 @@ void s390_reset_acc(struct mm_struct *mm)
|
||||
mmput(mm);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(s390_reset_acc);
|
||||
|
||||
/**
|
||||
* s390_unlist_old_asce - Remove the topmost level of page tables from the
|
||||
* list of page tables of the gmap.
|
||||
* @gmap: the gmap whose table is to be removed
|
||||
*
|
||||
* On s390x, KVM keeps a list of all pages containing the page tables of the
|
||||
* gmap (the CRST list). This list is used at tear down time to free all
|
||||
* pages that are now not needed anymore.
|
||||
*
|
||||
* This function removes the topmost page of the tree (the one pointed to by
|
||||
* the ASCE) from the CRST list.
|
||||
*
|
||||
* This means that it will not be freed when the VM is torn down, and needs
|
||||
* to be handled separately by the caller, unless a leak is actually
|
||||
* intended. Notice that this function will only remove the page from the
|
||||
* list, the page will still be used as a top level page table (and ASCE).
|
||||
*/
|
||||
void s390_unlist_old_asce(struct gmap *gmap)
|
||||
{
|
||||
struct page *old;
|
||||
|
||||
old = virt_to_page(gmap->table);
|
||||
spin_lock(&gmap->guest_table_lock);
|
||||
list_del(&old->lru);
|
||||
/*
|
||||
* Sometimes the topmost page might need to be "removed" multiple
|
||||
* times, for example if the VM is rebooted into secure mode several
|
||||
* times concurrently, or if s390_replace_asce fails after calling
|
||||
* s390_remove_old_asce and is attempted again later. In that case
|
||||
* the old asce has been removed from the list, and therefore it
|
||||
* will not be freed when the VM terminates, but the ASCE is still
|
||||
* in use and still pointed to.
|
||||
* A subsequent call to replace_asce will follow the pointer and try
|
||||
* to remove the same page from the list again.
|
||||
* Therefore it's necessary that the page of the ASCE has valid
|
||||
* pointers, so list_del can work (and do nothing) without
|
||||
* dereferencing stale or invalid pointers.
|
||||
*/
|
||||
INIT_LIST_HEAD(&old->lru);
|
||||
spin_unlock(&gmap->guest_table_lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(s390_unlist_old_asce);
|
||||
|
||||
/**
|
||||
* s390_replace_asce - Try to replace the current ASCE of a gmap with a copy
|
||||
* @gmap: the gmap whose ASCE needs to be replaced
|
||||
*
|
||||
* If the allocation of the new top level page table fails, the ASCE is not
|
||||
* replaced.
|
||||
* In any case, the old ASCE is always removed from the gmap CRST list.
|
||||
* Therefore the caller has to make sure to save a pointer to it
|
||||
* beforehand, unless a leak is actually intended.
|
||||
*/
|
||||
int s390_replace_asce(struct gmap *gmap)
|
||||
{
|
||||
unsigned long asce;
|
||||
struct page *page;
|
||||
void *table;
|
||||
|
||||
s390_unlist_old_asce(gmap);
|
||||
|
||||
page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER);
|
||||
if (!page)
|
||||
return -ENOMEM;
|
||||
table = page_to_virt(page);
|
||||
memcpy(table, gmap->table, 1UL << (CRST_ALLOC_ORDER + PAGE_SHIFT));
|
||||
|
||||
/*
|
||||
* The caller has to deal with the old ASCE, but here we make sure
|
||||
* the new one is properly added to the CRST list, so that
|
||||
* it will be freed when the VM is torn down.
|
||||
*/
|
||||
spin_lock(&gmap->guest_table_lock);
|
||||
list_add(&page->lru, &gmap->crst_list);
|
||||
spin_unlock(&gmap->guest_table_lock);
|
||||
|
||||
/* Set new table origin while preserving existing ASCE control bits */
|
||||
asce = (gmap->asce & ~_ASCE_ORIGIN) | __pa(table);
|
||||
WRITE_ONCE(gmap->asce, asce);
|
||||
WRITE_ONCE(gmap->mm->context.gmap_asce, asce);
|
||||
WRITE_ONCE(gmap->table, table);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(s390_replace_asce);
|
||||
|
||||
Reference in New Issue
Block a user