diff --git a/Documentation/devicetree/bindings/pci/phytium,phytium-pcie-ep.txt b/Documentation/devicetree/bindings/pci/phytium,phytium-pcie-ep.txt new file mode 100644 index 0000000000000000000000000000000000000000..0067be87b18f7645d1a66c61ed194ae92a167ba1 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/phytium,phytium-pcie-ep.txt @@ -0,0 +1,22 @@ +* Phytium PCIe endpoint controller + +Required properties: +- compatible: Should contain "phytium,pcie-ep-1.0" or + "phytium,pcie-ep-2.0" +- reg: Should contain the controller register base address, AXI interface + region base address and hpb register base address respectively. +- reg-names: Must be "reg", "mem" and "hpb" respectively. +- max-outbound-regions: Set to maximum number of outbound regions. +- max-functions: Maximum number of functions that can be configured (default 1). + +Example: + +ep0: ep@0x29030000 { + compatible = "phytium,pcie-ep-1.0"; + reg = <0x0 0x29030000 0x0 0x10000>, + <0x11 0x00000000 0x1 0x00000000>, + <0x0 0x29101000 0x0 0x1000>; + reg-names = "reg", "mem", "hpb"; + max-outbound-regions = <3>; + max-functions = /bits/ 8 <1>; +}; diff --git a/arch/arm64/configs/phytium_debug.config b/arch/arm64/configs/phytium_debug.config index 9e254d7662b4244374042e553eacff2fd7786110..368df7d1602227cff4dca5a53ca0a94553b5ddee 100644 --- a/arch/arm64/configs/phytium_debug.config +++ b/arch/arm64/configs/phytium_debug.config @@ -1,3 +1,4 @@ +CONFIG_IKHEADERS=y CONFIG_PRINTK_CALLER=y CONFIG_DYNAMIC_DEBUG=y # CONFIG_DEBUG_INFO_REDUCED is not set diff --git a/arch/arm64/configs/phytium_defconfig b/arch/arm64/configs/phytium_defconfig index d46443ff043f1d695134cbf7ba27008dd682bb25..653742e63f76731bf93945442526a35d407da9fe 100644 --- a/arch/arm64/configs/phytium_defconfig +++ b/arch/arm64/configs/phytium_defconfig @@ -13,6 +13,7 @@ CONFIG_TASK_XACCT=y CONFIG_TASK_IO_ACCOUNTING=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y +CONFIG_NUMA_BALANCING=y CONFIG_MEMCG=y CONFIG_BLK_CGROUP=y CONFIG_CGROUP_PIDS=y @@ -31,6 +32,7 @@ CONFIG_ARCH_PHYTIUM=y CONFIG_ARM64_VA_BITS_48=y CONFIG_SCHED_MC=y CONFIG_SCHED_SMT=y +CONFIG_NUMA=y CONFIG_KEXEC=y CONFIG_KEXEC_FILE=y CONFIG_CRASH_DUMP=y @@ -94,7 +96,6 @@ CONFIG_KSM=y CONFIG_MEMORY_FAILURE=y CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_CMA=y -CONFIG_CMA_AREAS=19 CONFIG_ZSMALLOC=m CONFIG_NET=y CONFIG_PACKET=y @@ -771,7 +772,6 @@ CONFIG_CRYPTO_DEV_HISI_HPRE=m CONFIG_CRYPTO_DEV_AMLOGIC_GXL=m CONFIG_INDIRECT_PIO=y CONFIG_DMA_CMA=y -CONFIG_DMA_PERNUMA_CMA=y CONFIG_CMA_SIZE_MBYTES=32 CONFIG_PRINTK_TIME=y CONFIG_DEBUG_INFO=y diff --git a/drivers/dma/phytium/phytium-gdmac.c b/drivers/dma/phytium/phytium-gdmac.c index 3fdf572196b0dd303b9c667d9a43320065c7f721..0154d6151e52a30cab0d2aef20fbb88e0eb9a422 100644 --- a/drivers/dma/phytium/phytium-gdmac.c +++ b/drivers/dma/phytium/phytium-gdmac.c @@ -29,7 +29,7 @@ #include #include "phytium-gdmac.h" -#define PHYTIUM_GDMA_DRIVER_VERSION "1.0.2" +#define PHYTIUM_GDMA_DRIVER_VERSION "1.0.3" static inline struct phytium_gdma_device *to_gdma_device(struct dma_chan *chan) { @@ -475,8 +475,6 @@ static int phytium_gdma_terminate_all(struct dma_chan *chan) { struct phytium_gdma_chan *gdma_chan = to_gdma_chan(chan); unsigned long flags = 0; - u32 val = 0; - int ret = 0; LIST_HEAD(head); spin_lock_irqsave(&gdma_chan->vchan.lock, flags); @@ -487,12 +485,9 @@ static int phytium_gdma_terminate_all(struct dma_chan *chan) vchan_terminate_vdesc(&gdma_chan->desc->vdesc); gdma_chan->desc = NULL; phytium_chan_disable(gdma_chan); - ret = readl_poll_timeout(gdma_chan->base + DMA_CX_STATE, val, - ~(val & BIT(4)), 10, 10000); - if (ret) - dev_err(chan_to_dev(gdma_chan), - "failed to complete writes\n"); phytium_chan_reset(gdma_chan); + phytium_chan_irq_disable(gdma_chan); + phytium_chan_clk_disable(gdma_chan); } vchan_get_all_descriptors(&gdma_chan->vchan, &head); @@ -524,10 +519,11 @@ static void phytium_gdma_free_chan_resources(struct dma_chan *chan) phytium_chan_disable(gdma_chan); phytium_chan_irq_disable(gdma_chan); + phytium_chan_clk_disable(gdma_chan); vchan_free_chan_resources(&gdma_chan->vchan); - dev_dbg(gdma->dev, "free channel %d\n", gdma_chan->id); + dev_info(gdma->dev, "free channel %d\n", gdma_chan->id); } static int phytium_gdma_slave_config(struct dma_chan *chan, @@ -753,8 +749,6 @@ static irqreturn_t phytium_dma_interrupt(int irq, void *dev_id) if (gdma->chan[i].desc) { phytium_chan_irq_handler(gdma_chan); - phytium_chan_disable(gdma_chan); - phytium_chan_clk_disable(gdma_chan); } } } diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index e1681bba33373487182939c29ae95d2c3961f048..6a25d71b3c72de8e3e0e24fdf6343a73fea4acd0 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -51,8 +51,6 @@ static LIST_HEAD(scmi_list); static DEFINE_MUTEX(scmi_list_mutex); /* Track the unique id for the transfers for debug & profiling purpose */ static atomic_t transfer_last_id; -/* Protection for scmi xfer, prevent transmission timeout */ -static DEFINE_MUTEX(scmi_xfer_mutex); /** * struct scmi_xfers_info - Structure to manage transfer information @@ -370,9 +368,6 @@ int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer) xfer->hdr.poll_completion = true; #endif - /* lock scmi xfer, too many scmi xfers may cause timeout */ - mutex_lock(&scmi_xfer_mutex); - trace_scmi_xfer_begin(xfer->transfer_id, xfer->hdr.id, xfer->hdr.protocol_id, xfer->hdr.seq, xfer->hdr.poll_completion); @@ -380,7 +375,6 @@ int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer) ret = info->desc->ops->send_message(cinfo, xfer); if (ret < 0) { dev_dbg(dev, "Failed to send message %d\n", ret); - mutex_unlock(&scmi_xfer_mutex); return ret; } @@ -413,7 +407,6 @@ int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer) trace_scmi_xfer_end(xfer->transfer_id, xfer->hdr.id, xfer->hdr.protocol_id, xfer->hdr.seq, ret); - mutex_unlock(&scmi_xfer_mutex); return ret; } diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c index ad773a657ed24fb977c99f2d5d1f1ee2618f4867..2d370788cca0c88cda3f12caba3ede3ec87c9b56 100644 --- a/drivers/firmware/arm_scmi/mailbox.c +++ b/drivers/firmware/arm_scmi/mailbox.c @@ -22,12 +22,14 @@ * @chan: Transmit/Receive mailbox channel * @cinfo: SCMI channel info * @shmem: Transmit/Receive shared memory area + * @chan_lock: Lock that prevents multiple xfers from being queued */ struct scmi_mailbox { struct mbox_client cl; struct mbox_chan *chan; struct scmi_chan_info *cinfo; struct scmi_shared_mem __iomem *shmem; + struct mutex chan_lock; }; #define client_to_scmi_mailbox(c) container_of(c, struct scmi_mailbox, cl) @@ -138,6 +140,7 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, cinfo->transport_info = smbox; smbox->cinfo = cinfo; + mutex_init(&smbox->chan_lock); return 0; } @@ -165,26 +168,33 @@ static int mailbox_send_message(struct scmi_chan_info *cinfo, struct scmi_mailbox *smbox = cinfo->transport_info; int ret; - ret = mbox_send_message(smbox->chan, xfer); + /* + * The mailbox layer has its own queue. However the mailbox queue + * confuses the per message SCMI timeouts since the clock starts when + * the message is submitted into the mailbox queue. So when multiple + * messages are queued up the clock starts on all messages instead of + * only the one inflight. + */ + mutex_lock(&smbox->chan_lock); - /* mbox_send_message returns non-negative value on success, so reset */ - if (ret > 0) - ret = 0; + ret = mbox_send_message(smbox->chan, xfer); + /* mbox_send_message returns non-negative value on success */ + if (ret < 0) { + mutex_unlock(&smbox->chan_lock); + return ret; + } - return ret; + return 0; } static void mailbox_mark_txdone(struct scmi_chan_info *cinfo, int ret) { struct scmi_mailbox *smbox = cinfo->transport_info; - /* - * NOTE: we might prefer not to need the mailbox ticker to manage the - * transfer queueing since the protocol layer queues things by itself. - * Unfortunately, we have to kick the mailbox framework after we have - * received our message. - */ mbox_client_txdone(smbox->chan, ret); + + /* Release channel */ + mutex_unlock(&smbox->chan_lock); } static void mailbox_fetch_response(struct scmi_chan_info *cinfo, diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 22f3b25a35150cb271cd5981a5ce69716453b24f..dff2b139c013eb0bf3666551e6a5625cc97c2224 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3533,17 +3533,68 @@ static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) static int macb_get_link_ksettings(struct net_device *netdev, struct ethtool_link_ksettings *kset) { + int ret = 0; struct macb *bp = netdev_priv(netdev); + u32 supported = 0; + u32 advertising = 0; + + if (!phylink_expects_phy(bp->phylink)) { + if (bp->phy_interface == PHY_INTERFACE_MODE_USXGMII || + bp->phy_interface == PHY_INTERFACE_MODE_XGMII) { + supported = SUPPORTED_10000baseT_Full + | SUPPORTED_FIBRE | SUPPORTED_Pause; + advertising = ADVERTISED_10000baseT_Full + | ADVERTISED_FIBRE | ADVERTISED_Pause; + kset->base.port = PORT_FIBRE; + kset->base.transceiver = XCVR_INTERNAL; + } else if (bp->phy_interface == PHY_INTERFACE_MODE_SGMII) { + supported = SUPPORTED_2500baseX_Full | SUPPORTED_1000baseT_Full + | SUPPORTED_100baseT_Full | SUPPORTED_10baseT_Full + | SUPPORTED_FIBRE | SUPPORTED_Pause; + advertising = ADVERTISED_2500baseX_Full | ADVERTISED_1000baseT_Full + | ADVERTISED_100baseT_Full | ADVERTISED_10baseT_Full + | ADVERTISED_FIBRE | ADVERTISED_Pause; + kset->base.port = PORT_FIBRE; + kset->base.transceiver = XCVR_INTERNAL; + } else if (bp->phy_interface == PHY_INTERFACE_MODE_RGMII) { + supported = SUPPORTED_1000baseT_Full | SUPPORTED_100baseT_Full + | SUPPORTED_10baseT_Full | SUPPORTED_TP; + advertising = ADVERTISED_1000baseT_Full | ADVERTISED_100baseT_Full + | ADVERTISED_10baseT_Full | ADVERTISED_TP; + } else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII) { + supported = SUPPORTED_100baseT_Full + | SUPPORTED_10baseT_Full | SUPPORTED_TP; + advertising = ADVERTISED_100baseT_Full + | ADVERTISED_10baseT_Full | ADVERTISED_TP; + } + + ethtool_convert_legacy_u32_to_link_mode(kset->link_modes.supported, + supported); + ethtool_convert_legacy_u32_to_link_mode(kset->link_modes.advertising, + advertising); + kset->base.speed = bp->speed; + kset->base.duplex = bp->duplex; + } else { + phylink_ethtool_ksettings_get(bp->phylink, kset); + } - return phylink_ethtool_ksettings_get(bp->phylink, kset); + return ret; } static int macb_set_link_ksettings(struct net_device *netdev, const struct ethtool_link_ksettings *kset) { struct macb *bp = netdev_priv(netdev); + int ret = 0; + + if (!phylink_expects_phy(bp->phylink)) { + netdev_err(netdev, "fixed link interface not supported set link\n"); + ret = -EOPNOTSUPP; + } else { + ret = phylink_ethtool_ksettings_set(bp->phylink, kset); + } - return phylink_ethtool_ksettings_set(bp->phylink, kset); + return ret; } static void macb_get_ringparam(struct net_device *netdev, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 4e8e3797aed089cf0c4625f58b3b89a65af97a60..074c9eb44ab73b5d26b2e6bc75247ea38c2a0531 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -1675,8 +1675,9 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg, } trace_mlx5_fs_set_fte(fte, false); + /* Link newly added rules into the tree. */ for (i = 0; i < handle->num_rules; i++) { - if (refcount_read(&handle->rule[i]->node.refcount) == 1) { + if (!handle->rule[i]->node.parent) { tree_add_node(&handle->rule[i]->node, &fte->node); trace_mlx5_fs_add_rule(handle->rule[i]); } diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c index fdf2c6ea41d96e70144a32968e0077c2a72f4658..d3964cd6d4ebc508574b5cc72c71ed336f3f2fde 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c @@ -155,6 +155,12 @@ static int iwl_dbg_tlv_alloc_debug_info(struct iwl_trans *trans, if (le32_to_cpu(tlv->length) != sizeof(*debug_info)) return -EINVAL; + /* we use this as a string, ensure input was NUL terminated */ + if (strnlen(debug_info->debug_cfg_name, + sizeof(debug_info->debug_cfg_name)) == + sizeof(debug_info->debug_cfg_name)) + return -EINVAL; + IWL_DEBUG_FW(trans, "WRT: Loading debug cfg: %s\n", debug_info->debug_cfg_name); diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c index 884f45e627a72ff40a7c4b764b47472a0426f5ef..457386f9de990f51ea0aa34d6737369347d56c0f 100644 --- a/drivers/net/wireless/microchip/wilc1000/hif.c +++ b/drivers/net/wireless/microchip/wilc1000/hif.c @@ -359,38 +359,49 @@ static void handle_connect_timeout(struct work_struct *work) void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, struct cfg80211_crypto_settings *crypto) { - struct wilc_join_bss_param *param; - struct ieee80211_p2p_noa_attr noa_attr; - u8 rates_len = 0; - const u8 *tim_elm, *ssid_elm, *rates_ie, *supp_rates_ie; + const u8 *ies_data, *tim_elm, *ssid_elm, *rates_ie, *supp_rates_ie; const u8 *ht_ie, *wpa_ie, *wmm_ie, *rsn_ie; + struct ieee80211_p2p_noa_attr noa_attr; + const struct cfg80211_bss_ies *ies; + struct wilc_join_bss_param *param; + u8 rates_len = 0, ies_len; int ret; - const struct cfg80211_bss_ies *ies = rcu_dereference(bss->ies); param = kzalloc(sizeof(*param), GFP_KERNEL); if (!param) return NULL; + rcu_read_lock(); + ies = rcu_dereference(bss->ies); + ies_data = kmemdup(ies->data, ies->len, GFP_ATOMIC); + if (!ies_data) { + rcu_read_unlock(); + kfree(param); + return NULL; + } + ies_len = ies->len; + rcu_read_unlock(); + param->beacon_period = cpu_to_le16(bss->beacon_interval); param->cap_info = cpu_to_le16(bss->capability); param->bss_type = WILC_FW_BSS_TYPE_INFRA; param->ch = ieee80211_frequency_to_channel(bss->channel->center_freq); ether_addr_copy(param->bssid, bss->bssid); - ssid_elm = cfg80211_find_ie(WLAN_EID_SSID, ies->data, ies->len); + ssid_elm = cfg80211_find_ie(WLAN_EID_SSID, ies_data, ies_len); if (ssid_elm) { if (ssid_elm[1] <= IEEE80211_MAX_SSID_LEN) memcpy(param->ssid, ssid_elm + 2, ssid_elm[1]); } - tim_elm = cfg80211_find_ie(WLAN_EID_TIM, ies->data, ies->len); + tim_elm = cfg80211_find_ie(WLAN_EID_TIM, ies_data, ies_len); if (tim_elm && tim_elm[1] >= 2) param->dtim_period = tim_elm[3]; memset(param->p_suites, 0xFF, 3); memset(param->akm_suites, 0xFF, 3); - rates_ie = cfg80211_find_ie(WLAN_EID_SUPP_RATES, ies->data, ies->len); + rates_ie = cfg80211_find_ie(WLAN_EID_SUPP_RATES, ies_data, ies_len); if (rates_ie) { rates_len = rates_ie[1]; if (rates_len > WILC_MAX_RATES_SUPPORTED) @@ -401,7 +412,7 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, if (rates_len < WILC_MAX_RATES_SUPPORTED) { supp_rates_ie = cfg80211_find_ie(WLAN_EID_EXT_SUPP_RATES, - ies->data, ies->len); + ies_data, ies_len); if (supp_rates_ie) { u8 ext_rates = supp_rates_ie[1]; @@ -416,11 +427,11 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, } } - ht_ie = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, ies->data, ies->len); + ht_ie = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, ies_data, ies_len); if (ht_ie) param->ht_capable = true; - ret = cfg80211_get_p2p_attr(ies->data, ies->len, + ret = cfg80211_get_p2p_attr(ies_data, ies_len, IEEE80211_P2P_ATTR_ABSENCE_NOTICE, (u8 *)&noa_attr, sizeof(noa_attr)); if (ret > 0) { @@ -444,7 +455,7 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, } wmm_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, WLAN_OUI_TYPE_MICROSOFT_WMM, - ies->data, ies->len); + ies_data, ies_len); if (wmm_ie) { struct ieee80211_wmm_param_ie *ie; @@ -459,13 +470,13 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, wpa_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, WLAN_OUI_TYPE_MICROSOFT_WPA, - ies->data, ies->len); + ies_data, ies_len); if (wpa_ie) { param->mode_802_11i = 1; param->rsn_found = true; } - rsn_ie = cfg80211_find_ie(WLAN_EID_RSN, ies->data, ies->len); + rsn_ie = cfg80211_find_ie(WLAN_EID_RSN, ies_data, ies_len); if (rsn_ie) { int rsn_ie_len = sizeof(struct element) + rsn_ie[1]; int offset = 8; @@ -499,6 +510,7 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, param->akm_suites[i] = crypto->akm_suites[i] & 0xFF; } + kfree(ies_data); return (void *)param; } diff --git a/drivers/pci/controller/pcie-phytium-ep.c b/drivers/pci/controller/pcie-phytium-ep.c index 816ed10a66bf00613f36c8abab038d14ade5166b..6373c875ad817a812f477e1b0f5aec45bd64a4eb 100644 --- a/drivers/pci/controller/pcie-phytium-ep.c +++ b/drivers/pci/controller/pcie-phytium-ep.c @@ -25,6 +25,8 @@ #include "pcie-phytium-ep.h" #include "pcie-phytium-register.h" +#define PHYTIUM_PCIE_EP_DRIVER_VERSION "1.1.2" + #define PHYTIUM_PCIE_EP_IRQ_PCI_ADDR_NONE 0x0 #define PHYTIUM_PCIE_EP_IRQ_PCI_ADDR_LEGACY 0x1 @@ -329,6 +331,18 @@ static int phytium_pcie_ep_start(struct pci_epc *epc) return 0; } +static const struct pci_epc_features phytium_pcie_epc_features = { + .linkup_notifier = false, + .msi_capable = true, + .msix_capable = false, +}; + +static const struct pci_epc_features* +phytium_pcie_ep_get_features(struct pci_epc *epc, u8 func_no) +{ + return &phytium_pcie_epc_features; +} + static const struct pci_epc_ops phytium_pcie_epc_ops = { .write_header = phytium_pcie_ep_write_header, .set_bar = phytium_pcie_ep_set_bar, @@ -339,14 +353,34 @@ static const struct pci_epc_ops phytium_pcie_epc_ops = { .get_msi = phytium_pcie_ep_get_msi, .raise_irq = phytium_pcie_ep_raise_irq, .start = phytium_pcie_ep_start, + .get_features = phytium_pcie_ep_get_features, }; +static const struct phytium_pcie_ep_config pcie_ep_1p0_config = +{ + .hpb_perf_base_limit_offs = 0xA30, +}; +static const struct phytium_pcie_ep_config pcie_ep_2p0_config = +{ + .hpb_perf_base_limit_offs = 0xA40, +}; + +static const struct of_device_id phytium_pcie_ep_of_match[] = { + { .compatible = "phytium,pcie-ep-1.0", + .data = &pcie_ep_1p0_config }, + { .compatible = "phytium,pcie-ep-2.0", + .data = &pcie_ep_2p0_config }, + { }, +}; static int phytium_pcie_ep_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + const struct of_device_id *match = NULL; struct phytium_pcie_ep *priv = NULL; + const struct phytium_pcie_ep_config *pcie_ep_config = + &pcie_ep_2p0_config; struct resource *res; struct device_node *np = dev->of_node; struct pci_epc *epc; @@ -357,6 +391,13 @@ static int phytium_pcie_ep_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; + match = of_match_node(phytium_pcie_ep_of_match, pdev->dev.of_node); + if (match && match->data) { + pcie_ep_config = match->data; + } + priv->hpb_perf_base_limit_offs = + pcie_ep_config->hpb_perf_base_limit_offs; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "reg"); priv->reg_base = devm_ioremap_resource(dev, res); if (IS_ERR(priv->reg_base)) { @@ -428,13 +469,13 @@ static int phytium_pcie_ep_probe(struct platform_device *pdev) & C0_PREF_BASE_MASK) << C0_PREF_BASE_SHIFT; value |= (((lower_32_bits(priv->mem_res->end) >> C0_PREF_VALUE_SHIFT) & C0_PREF_LIMIT_MASK) << C0_PREF_LIMIT_SHIFT); - phytium_hpb_writel(priv, PHYTIUM_HPB_C0_PREF_BASE_LIMIT, value); + phytium_hpb_writel(priv, priv->hpb_perf_base_limit_offs, value); value = ((upper_32_bits(priv->mem_res->start) >> C0_PREF_UP32_VALUE_SHIFT) & C0_PREF_BASE_UP32_MASK) << C0_PREF_BASE_UP32_SHIFT; value |= (((upper_32_bits(priv->mem_res->end) >> C0_PREF_UP32_VALUE_SHIFT) & C0_PREF_LIMIT_UP32_MASK) << C0_PREF_LIMIT_UP32_SHIFT); - phytium_hpb_writel(priv, PHYTIUM_HPB_C0_PREF_BASE_LIMIT_UP32, value); + phytium_hpb_writel(priv, priv->hpb_perf_base_limit_offs + 0x04, value); dev_dbg(dev, "exit %s successful\n", __func__); return 0; @@ -455,11 +496,6 @@ static int phytium_pcie_ep_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id phytium_pcie_ep_of_match[] = { - { .compatible = "phytium,pd2008-pcie-ep" }, - { }, -}; - static struct platform_driver phytium_pcie_ep_driver = { .driver = { .name = "phytium-pcie-ep", @@ -468,9 +504,10 @@ static struct platform_driver phytium_pcie_ep_driver = { .probe = phytium_pcie_ep_probe, .remove = phytium_pcie_ep_remove, }; - +MODULE_DEVICE_TABLE(of, phytium_pcie_ep_of_match); module_platform_driver(phytium_pcie_ep_driver); MODULE_LICENSE("GPL"); +MODULE_VERSION(PHYTIUM_PCIE_EP_DRIVER_VERSION); MODULE_AUTHOR("Yang Xun "); MODULE_DESCRIPTION("Phytium Pcie Controller Endpoint driver"); diff --git a/drivers/pci/controller/pcie-phytium-ep.h b/drivers/pci/controller/pcie-phytium-ep.h index d53cc010585a421c5c74a43a24aedec9d8d26b27..025b049f29fb9f3471583888f76222f478b22591 100644 --- a/drivers/pci/controller/pcie-phytium-ep.h +++ b/drivers/pci/controller/pcie-phytium-ep.h @@ -15,13 +15,20 @@ #ifndef __PCIE_PHYTIUM_EP_H__ #define __PCIE_PHYTIUM_EP_H__ +#include #include "pcie-phytium-register.h" #define IRQ_MAPPING_SIZE 0x1000 + +struct phytium_pcie_ep_config { + u32 hpb_perf_base_limit_offs; +}; + struct phytium_pcie_ep { void __iomem *reg_base; struct resource *mem_res; void __iomem *hpb_base; + u32 hpb_perf_base_limit_offs; unsigned int max_regions; unsigned long ob_region_map; phys_addr_t *ob_addr; diff --git a/drivers/spi/spi-phytium-qspi.c b/drivers/spi/spi-phytium-qspi.c index 8695b627c85c82d1f0430a171c0044171230a734..d044ff6082fbec24253e13e753bd1b6443600cd9 100755 --- a/drivers/spi/spi-phytium-qspi.c +++ b/drivers/spi/spi-phytium-qspi.c @@ -286,29 +286,6 @@ static int phytium_qspi_flash_capacity_encode(u32 size, u32 *cap) return ret; } -static void phytium_qspi_clear_wr(struct phytium_qspi *qspi, - struct phytium_qspi_flash *flash) -{ - u32 cmd = 0; - u32 state = 0; - int ret = 0; - - cmd |= 0x05 << QSPI_CMD_PORT_CMD_SHIFT; - cmd |= BIT(QSPI_CMD_PORT_TRANSFER_SHIFT); - cmd |= flash->cs << QSPI_CMD_PORT_CS_SHIFT; - - writel_relaxed(cmd, qspi->io_base + QSPI_CMD_PORT_REG); - readl_relaxed(qspi->io_base + QSPI_LD_PORT_REG); - - ret = readl_poll_timeout(qspi->io_base + QSPI_LD_PORT_REG, - state, !(state & 0x01), 10, 100000); - if (ret) - dev_err(qspi->dev, "wait device timeout\n"); - - /* clear wr_cfg */ - writel_relaxed(0x0, qspi->io_base + QSPI_WR_CFG_REG); -} - static int phytium_qspi_write_port(struct phytium_qspi *qspi, const u8 *buf, const size_t len) { @@ -513,6 +490,7 @@ static int phytium_qspi_dirmap_create(struct spi_mem_dirmap_desc *desc) cmd |= QSPI_WR_CFG_WR_MODE_MASK; cmd |= flash->clk_div & QSPI_WR_CFG_WR_SCK_SEL_MASK; + writel_relaxed(cmd, qspi->io_base + QSPI_WR_CFG_REG); qspi->wr_cfg_reg = cmd; } else { ret = -EINVAL; @@ -550,9 +528,6 @@ static ssize_t phytium_qspi_dirmap_write(struct spi_mem_dirmap_desc *desc, size_t mask = 0x03; u_char tmp[4] = {0}; - /* set wr_cfg for drimap write */ - writel_relaxed(qspi->wr_cfg_reg, qspi->io_base + QSPI_WR_CFG_REG); - if (offs & 0x03) { dev_err(qspi->dev, "Addr not four-byte aligned!\n"); return -EINVAL; @@ -570,8 +545,6 @@ static ssize_t phytium_qspi_dirmap_write(struct spi_mem_dirmap_desc *desc, //write cache data to flash writel_relaxed(QSPI_FLUSH_EN, qspi->io_base + QSPI_FLUSH_REG); - phytium_qspi_clear_wr(qspi, flash); - return len; } @@ -796,6 +769,11 @@ static int phytium_qspi_remove(struct platform_device *pdev) static int __maybe_unused phytium_qspi_suspend(struct device *dev) { + struct phytium_qspi *qspi = dev_get_drvdata(dev); + + /* clear rd_cfg reg and wr_cfg reg when suspend */ + writel_relaxed(0, qspi->io_base + QSPI_RD_CFG_REG); + writel_relaxed(0, qspi->io_base + QSPI_WR_CFG_REG); return pm_runtime_force_suspend(dev); } @@ -803,8 +781,9 @@ static int __maybe_unused phytium_qspi_resume(struct device *dev) { struct phytium_qspi *qspi = dev_get_drvdata(dev); - /* set rd_cfg reg and flash_capacity reg after resume */ + /* set rd_cfg reg, wr_cfg reg and flash_capacity reg after resume */ writel_relaxed(qspi->rd_cfg_reg, qspi->io_base + QSPI_RD_CFG_REG); + writel_relaxed(qspi->wr_cfg_reg, qspi->io_base + QSPI_WR_CFG_REG); writel_relaxed(qspi->flash_cap, qspi->io_base + QSPI_FLASH_CAP_REG); return pm_runtime_force_resume(dev); } diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c index 832d9f9cd10addeff5ef4556429d5beca815abf6..df572724f254d8bd735d75d369bbc5b88a76ef52 100644 --- a/net/ipv6/netfilter/nf_reject_ipv6.c +++ b/net/ipv6/netfilter/nf_reject_ipv6.c @@ -89,33 +89,23 @@ void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb, const struct tcphdr *oth, unsigned int otcplen) { struct tcphdr *tcph; - int needs_ack; skb_reset_transport_header(nskb); - tcph = skb_put(nskb, sizeof(struct tcphdr)); + tcph = skb_put_zero(nskb, sizeof(struct tcphdr)); /* Truncate to length (no data) */ tcph->doff = sizeof(struct tcphdr)/4; tcph->source = oth->dest; tcph->dest = oth->source; if (oth->ack) { - needs_ack = 0; tcph->seq = oth->ack_seq; - tcph->ack_seq = 0; } else { - needs_ack = 1; tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn + oth->fin + otcplen - (oth->doff<<2)); - tcph->seq = 0; + tcph->ack = 1; } - /* Reset flags */ - ((u_int8_t *)tcph)[13] = 0; tcph->rst = 1; - tcph->ack = needs_ack; - tcph->window = 0; - tcph->urg_ptr = 0; - tcph->check = 0; /* Adjust TCP checksum */ tcph->check = csum_ipv6_magic(&ipv6_hdr(nskb)->saddr, diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c index 2278c0234c4979551ed32ef02c8d09f8d48a2007..786d05c74cabf099630ee101f02857f55b64eef5 100644 --- a/net/ipv6/seg6.c +++ b/net/ipv6/seg6.c @@ -451,22 +451,24 @@ int __init seg6_init(void) { int err; - err = genl_register_family(&seg6_genl_family); + err = register_pernet_subsys(&ip6_segments_ops); if (err) goto out; - err = register_pernet_subsys(&ip6_segments_ops); + err = genl_register_family(&seg6_genl_family); if (err) - goto out_unregister_genl; + goto out_unregister_pernet; #ifdef CONFIG_IPV6_SEG6_LWTUNNEL err = seg6_iptunnel_init(); if (err) - goto out_unregister_pernet; + goto out_unregister_genl; err = seg6_local_init(); - if (err) - goto out_unregister_pernet; + if (err) { + seg6_iptunnel_exit(); + goto out_unregister_genl; + } #endif #ifdef CONFIG_IPV6_SEG6_HMAC @@ -487,11 +489,13 @@ int __init seg6_init(void) #endif #endif #ifdef CONFIG_IPV6_SEG6_LWTUNNEL -out_unregister_pernet: - unregister_pernet_subsys(&ip6_segments_ops); -#endif out_unregister_genl: +#endif +#if IS_ENABLED(CONFIG_IPV6_SEG6_LWTUNNEL) || IS_ENABLED(CONFIG_IPV6_SEG6_HMAC) genl_unregister_family(&seg6_genl_family); +#endif +out_unregister_pernet: + unregister_pernet_subsys(&ip6_segments_ops); goto out; } diff --git a/security/keys/key.c b/security/keys/key.c index 67ad0826e385c22dc98cfd60c5039c3629e72d63..e5111ce17e2545bc58a7cf5a291c46b3fe97b12d 100644 --- a/security/keys/key.c +++ b/security/keys/key.c @@ -464,7 +464,8 @@ static int __key_instantiate_and_link(struct key *key, if (authkey) key_invalidate(authkey); - key_set_expiry(key, prep->expiry); + if (prep->expiry != TIME64_MAX) + key_set_expiry(key, prep->expiry); } } diff --git a/sound/soc/phytium/pmdk_dp.c b/sound/soc/phytium/pmdk_dp.c index ce56634aef2259e34ca74fe6c67012b4e003eef2..38c977d66ab88e50bdaf04d364c07bfb930c5452 100755 --- a/sound/soc/phytium/pmdk_dp.c +++ b/sound/soc/phytium/pmdk_dp.c @@ -48,6 +48,11 @@ static int pmdk_dp0_init(struct snd_soc_pcm_runtime *runtime) dev_err(card->dev, "Jack creation failed %d\n", ret); return ret; } + ret = snd_jack_add_new_kctl(priv->jack0.jack, "HDMI/DP,pcm=0", + SND_JACK_LINEOUT); + if (ret) + dev_warn(card->dev, "failed creating Jack kctl %d\n", ret); + snd_soc_component_set_jack(component, &priv->jack0, NULL); return ret; } @@ -66,6 +71,10 @@ static int pmdk_dp1_init(struct snd_soc_pcm_runtime *runtime) dev_err(card->dev, "Jack creation failed %d\n", ret); return ret; } + ret = snd_jack_add_new_kctl(priv->jack1.jack, "HDMI/DP,pcm=1", + SND_JACK_LINEOUT); + if (ret) + dev_warn(card->dev, "failed creating Jack kctl %d\n", ret); snd_soc_component_set_jack(component, &priv->jack1, NULL); return ret; } @@ -84,6 +93,10 @@ static int pmdk_dp2_init(struct snd_soc_pcm_runtime *runtime) dev_err(card->dev, "Jack creation failed %d\n", ret); return ret; } + ret = snd_jack_add_new_kctl(priv->jack2.jack, "HDMI/DP,pcm=2", + SND_JACK_LINEOUT); + if (ret) + dev_warn(card->dev, "failed creating Jack kctl %d\n", ret); snd_soc_component_set_jack(component, &priv->jack2, NULL); return ret; }